<!--
@license
Copyright (C) 2017 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>gr-edit-file-controls</title>

<script src="/bower_components/webcomponentsjs/custom-elements-es5-adapter.js"></script>

<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<script src="/bower_components/web-component-tester/browser.js"></script>
<script src="../../../test/test-pre-setup.js"></script>
<link rel="import" href="../../../test/common-test-setup.html"/>

<link rel="import" href="../gr-edit-constants.html">
<link rel="import" href="gr-edit-file-controls.html">

<script>void(0);</script>

<test-fixture id="basic">
  <template>
    <gr-edit-file-controls></gr-edit-file-controls>
  </template>
</test-fixture>

<script>
  suite('gr-edit-file-controls tests', async () => {
    await readyToTest();
    let element;
    let sandbox;
    let fileActionHandler;
  
    setup(() => {
      sandbox = sinon.sandbox.create();
      element = fixture('basic');
      fileActionHandler = sandbox.stub();
      element.addEventListener('file-action-tap', fileActionHandler);
    });
  
    teardown(() => { sandbox.restore(); });
  
    test('open tap emits event', () => {
      const actions = element.$.actions;
      element.filePath = 'foo';
      actions._open();
      flushAsynchronousOperations();
  
      MockInteractions.tap(actions.$$('li [data-id="open"]'));
      assert.isTrue(fileActionHandler.called);
      assert.deepEqual(fileActionHandler.lastCall.args[0].detail,
          {action: GrEditConstants.Actions.OPEN.id, path: 'foo'});
    });
  
    test('delete tap emits event', () => {
      const actions = element.$.actions;
      element.filePath = 'foo';
      actions._open();
      flushAsynchronousOperations();
  
      MockInteractions.tap(actions.$$('li [data-id="delete"]'));
      assert.isTrue(fileActionHandler.called);
      assert.deepEqual(fileActionHandler.lastCall.args[0].detail,
          {action: GrEditConstants.Actions.DELETE.id, path: 'foo'});
    });
  
    test('restore tap emits event', () => {
      const actions = element.$.actions;
      element.filePath = 'foo';
      actions._open();
      flushAsynchronousOperations();
  
      MockInteractions.tap(actions.$$('li [data-id="restore"]'));
      assert.isTrue(fileActionHandler.called);
      assert.deepEqual(fileActionHandler.lastCall.args[0].detail,
          {action: GrEditConstants.Actions.RESTORE.id, path: 'foo'});
    });
  
    test('rename tap emits event', () => {
      const actions = element.$.actions;
      element.filePath = 'foo';
      actions._open();
      flushAsynchronousOperations();
  
      MockInteractions.tap(actions.$$('li [data-id="rename"]'));
      assert.isTrue(fileActionHandler.called);
      assert.deepEqual(fileActionHandler.lastCall.args[0].detail,
          {action: GrEditConstants.Actions.RENAME.id, path: 'foo'});
    });
  
    test('computed properties', () => {
      assert.equal(element._allFileActions.length, 4);
    });
  });
</script>
