<commit_before><!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://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 http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">

  <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
  <script src="../../web-component-tester/browser.js"></script>

  <!-- Step 1: import the element to test -->
  <link rel="import" href="../sweet-material-table.html">
</head>
<body>

<!-- You can use the document as a place to set up your fixtures. -->
<sweet-material-table></sweet-material-table>

<script>
  var tableEl = document.querySelector('sweet-material-table');

  describe('<sweet-material-table>', function () {

    describe('title binding functionality', function () {
      beforeEach(function (done) {

        tableEl.data = [
          {
            sku: 'SK-123',
            title: 'SK product',
            price: 12.22
          },
          {
            sku: 'SK-124',
            title: 'SK product 2',
            price: 0.99
          },
          {
            sku: 'SK-125',
            title: 'SK product 3',
            price: 19.99
          }
        ];

        tableEl.schema = {
          title: 'Products',
          properties: {
            sku: {
              type: 'string',
              title: 'SKU'
            },
            content: {
              type: 'string',
              title: 'Title'
            },
            price: {
              type: 'number',
              title: 'Price'
            }
          }
        };

        setTimeout(done, 1); // Needs a tick for the table to actually render
      });

      it('should display title if the property is present', function (done) {

        var title = 'The Kragle';
        tableEl.set('title', title);

        tableEl.set('schema', {
          title: 'Products',
          properties: {
            sku: {
              type: 'string',
              title: 'SKU'
            },
            content: {
              type: 'string',
              title: 'Title'
            },
            price: {
              type: 'number',
              title: 'Price'
            }
          }
        });

        expect(tableEl.$.title.innerHTML).to.match(new RegExp(title));
        done();
      });

      it.only('should display the schema title if present and no title present', function (done) {

        tableEl.set('title', null);

        tableEl.set('schema', {
          title: 'Products',
          properties: {
            sku: {
              type: 'string',
              title: 'SKU'
            },
            content: {
              type: 'string',
              title: 'Title'
            },
            price: {
              type: 'number',
              title: 'Price'
            }
          }
        });

        expect(tableEl.$.title.innerHTML).to.match(new RegExp(tableEl.schema.title));
        done();
      });

    });

  });
</script>

</body>
</html><commit_msg>Fixing title tests being broken since #title is now included in a dom-if template<commit_after><!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://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 http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">

  <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
  <script src="../../web-component-tester/browser.js"></script>

  <!-- Step 1: import the element to test -->
  <link rel="import" href="../sweet-material-table.html">
</head>
<body>

<!-- You can use the document as a place to set up your fixtures. -->
<sweet-material-table></sweet-material-table>

<script>
  var tableEl = document.querySelector('sweet-material-table');

  describe('<sweet-material-table>', function () {

    describe('title binding functionality', function () {
      beforeEach(function (done) {

        tableEl.data = [
          {
            sku: 'SK-123',
            title: 'SK product',
            price: 12.22
          },
          {
            sku: 'SK-124',
            title: 'SK product 2',
            price: 0.99
          },
          {
            sku: 'SK-125',
            title: 'SK product 3',
            price: 19.99
          }
        ];

        tableEl.schema = {
          title: 'Products',
          properties: {
            sku: {
              type: 'string',
              title: 'SKU'
            },
            content: {
              type: 'string',
              title: 'Title'
            },
            price: {
              type: 'number',
              title: 'Price'
            }
          }
        };

        setTimeout(done, 1); // Needs a tick for the table to actually render
      });

      it('should display title if the property is present', function (done) {

        var title = 'The Kragle';
        tableEl.set('title', title);

        tableEl.set('schema', {
          title: 'Products',
          properties: {
            sku: {
              type: 'string',
              title: 'SKU'
            },
            content: {
              type: 'string',
              title: 'Title'
            },
            price: {
              type: 'number',
              title: 'Price'
            }
          }
        });

        expect(tableEl.querySelector('#title').innerHTML).to.match(new RegExp(title));
        done();
      });

      it.only('should display the schema title if present and no title present', function (done) {

        tableEl.set('title', null);

        tableEl.set('schema', {
          title: 'Products',
          properties: {
            sku: {
              type: 'string',
              title: 'SKU'
            },
            content: {
              type: 'string',
              title: 'Title'
            },
            price: {
              type: 'number',
              title: 'Price'
            }
          }
        });

        expect(tableEl.querySelector('#title').innerHTML).to.match(new RegExp(tableEl.schema.title));
        done();
      });

    });

  });
</script>

</body>
</html>
{'fraction_non_alphanumeric': 0.1353426215524595, 'fraction_numerical': 0.009382996872334376, 'mean_word_length': 1.5684556407447974, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3178340', 'n_tokens_mistral': 1999, 'n_tokens_neox': 1886, 'n_words': 518}