<!doctype html> <!– @license Copyright © 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at polymer.github.io/LICENSE.txt The complete set of authors may be found at polymer.github.io/AUTHORS.txt The complete set of contributors may be found at polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at polymer.github.io/PATENTS.txt –> <html> <head>

<meta charset="UTF-8">
<title>paper-material basic tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

<script src="../../webcomponentsjs/webcomponents.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link href="../paper-material.html" rel="import">

</head> <body>

<test-fixture id="TrivialCard">
  <template>
    <paper-material elevation="1"></paper-material>
  </template>
</test-fixture>

<test-fixture id="ProgressiveElevations">
  <template>
    <paper-material elevation="1"></paper-material>
    <paper-material elevation="2"></paper-material>
    <paper-material elevation="3"></paper-material>
    <paper-material elevation="4"></paper-material>
    <paper-material elevation="5"></paper-material>
  </template>
</test-fixture>

<script>
  suite('<paper-material>', function() {
    suite('with a non-zero elevation attribute', function() {
      var style;
      var card;

      setup(function() {
        card = fixture('TrivialCard');
        style = window.getComputedStyle(card);
      });

      test('has a shadow', function() {
        expect(style.boxShadow).to.be.ok;
        expect(style.boxShadow).to.not.be.eql('none');
      });

      test('loses shadow with elevation value 0', function() {
        card.elevation = 0;
        expect(style.boxShadow).to.be.eql('none');
      });
    });

    suite('progressively increasing values of elevation', function() {
      var cards;

      setup(function() {
        cards = fixture('ProgressiveElevations');
      });

      test('yield progressively "deeper" cards', function() {
        var lastStyle;
        var style;

        expect(cards.length).to.be.eql(5);

        cards.forEach(function (card) {
          style = window.getComputedStyle(card);

          expect(style.boxShadow).to.be.ok;
          expect(style.boxShadow).to.not.be.eql('none');
          expect(style.boxShadow).to.not.be.eql(lastStyle && lastStyle.boxShadow);

          lastStyle = style;
        });
      });
    });
  });
</script>

</body> </html>