paper-fab-speed-dial.html 1.73 KB
<!doctype html>

<html>
<head>
  <meta charset="UTF-8">
  <title>paper-fab-speed-dial tests</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

  <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
  <script src="../../web-component-tester/browser.js"></script>
  <script src="../../test-fixture/test-fixture-mocha.js"></script>
  <script src="../../iron-test-helpers/mock-interactions.js"></script>

  <link rel="import" href="../../paper-fab/paper-fab.html">
  <link rel="import" href="../paper-fab-speed-dial.html">
  <link rel="import" href="../../test-fixture/test-fixture.html">

</head>
<body>

  <test-fixture id="SpeedDial">
    <template>
      <paper-fab-speed-dial>
        <paper-fab class="dropdown-trigger"></paper-fab>
        <div class="dropdown-content">content</div>
      </paper-fab-morph>
    </template>
  </test-fixture>

  <script>

    suite('<paper-fab-speed-dial>', function() {

      suite('basic', function() {

        var trigger;
        var content;
        var dropdown;

        setup(function() {
          var morph = fixture('SpeedDial');
          trigger = Polymer.dom(morph).querySelector('.dropdown-trigger');
          dropdown = morph.querySelector('iron-dropdown');
        });

        test('dropdown is initially closed', function() {
          expect(dropdown.opened).to.be.equal(false);
        });

        test('tapping the trigger opens the dropdown', function(done) {
          MockInteractions.downAndUp(trigger, function() {
            Polymer.Base.async(function() {
              expect(dropdown.opened).to.be.equal(true);
              done();
            }, 100);
          });
        });

      });

    });
  </script>

</body>
</html>