<commit_before><!doctype html>
<!--
Copyright (c) 2014 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>
    <title>bind object + repeat</title>
    <script src="../../../platform/platform.js"></script>
    <link rel="import" href="../../polymer.html">
    <script src="../../../tools/test/htmltest.js"></script>
    <script src="../../../tools/test/chai/chai.js"></script>
  </head>
  <body>
    <polymer-element name="x-foo" attributes="obj">
      <template>
        <p>obj.foo is {{obj.foo}}</p>
      </template>
      <script>
        Polymer('x-foo', {
          //alwaysPrepare: true,
          createdCallback: function() {
            //console.log(this.localName + ': createdCallback!');
            this.super();
          },
          enteredView: function() {
            //console.log(this.localName + ': enteredView!');
          },
          ready: function() {
            //console.log(this.localName + ': created!');
          }
        })
      </script>
    </polymer-element>
    
    <polymer-element name="x-bind-obj">
      <template>
        <x-foo id="foo" obj="{{testObj}}"></x-foo>
        <div id="container">
          <template repeat="{{arr}}">
            <x-foo obj="{{}}"></x-foo>
          </template>
        </div>
      </template>
      <script>
        Polymer('x-bind-obj', {
          testObj: null,
          arr: null,
          ready: function() {
            this.testObj = {foo: 'single'};
            this.arr = [
              {foo: 'array 0'},
              {foo: 'array 1'},
              {foo: 'array 2'}
            ];
            this.onMutation(this.$.container, function() {
              this.test();
            });
          },
          test: function() {
            // TODO(sorvell): we're watching for a mutation on container
            // this mutation is observed before CE notices that the children
            // of container. That's probably because of the order of mutation
            // observers.
            //CustomElements.takeRecords();
            chai.assert.equal(this.$.foo.obj, this.testObj);
            function checkXFoo(xFoo) {
              var p = xFoo.shadowRoot.querySelector('p');
              chai.assert.isDefined(xFoo.obj.foo);
              chai.assert.equal(p.innerHTML, 'obj.foo is ' + xFoo.obj.foo);
            }
            checkXFoo(this.$.foo);
            var xfoos = this.$.container.querySelectorAll('x-foo');
            chai.assert.equal(xfoos.length, 3, 'there should be 3 xfoos from the repeat');
            Array.prototype.forEach.call(xfoos, function(x) {
              checkXFoo(x);
            });
            done();
          }
        });
      </script>
    </polymer-element>
    
    <x-bind-obj></x-bind-obj>
  </body>
</html>
<commit_msg>remove outdated comment.<commit_after><!doctype html>
<!--
Copyright (c) 2014 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>
    <title>bind object + repeat</title>
    <script src="../../../platform/platform.js"></script>
    <link rel="import" href="../../polymer.html">
    <script src="../../../tools/test/htmltest.js"></script>
    <script src="../../../tools/test/chai/chai.js"></script>
  </head>
  <body>
    <polymer-element name="x-foo" attributes="obj">
      <template>
        <p>obj.foo is {{obj.foo}}</p>
      </template>
      <script>
        Polymer('x-foo', {
          //alwaysPrepare: true,
          createdCallback: function() {
            //console.log(this.localName + ': createdCallback!');
            this.super();
          },
          enteredView: function() {
            //console.log(this.localName + ': enteredView!');
          },
          ready: function() {
            //console.log(this.localName + ': created!');
          }
        })
      </script>
    </polymer-element>
    
    <polymer-element name="x-bind-obj">
      <template>
        <x-foo id="foo" obj="{{testObj}}"></x-foo>
        <div id="container">
          <template repeat="{{arr}}">
            <x-foo obj="{{}}"></x-foo>
          </template>
        </div>
      </template>
      <script>
        Polymer('x-bind-obj', {
          testObj: null,
          arr: null,
          ready: function() {
            this.testObj = {foo: 'single'};
            this.arr = [
              {foo: 'array 0'},
              {foo: 'array 1'},
              {foo: 'array 2'}
            ];
            this.onMutation(this.$.container, function() {
              this.test();
            });
          },
          test: function() {
            chai.assert.equal(this.$.foo.obj, this.testObj);
            function checkXFoo(xFoo) {
              var p = xFoo.shadowRoot.querySelector('p');
              chai.assert.isDefined(xFoo.obj.foo);
              chai.assert.equal(p.innerHTML, 'obj.foo is ' + xFoo.obj.foo);
            }
            checkXFoo(this.$.foo);
            var xfoos = this.$.container.querySelectorAll('x-foo');
            chai.assert.equal(xfoos.length, 3, 'there should be 3 xfoos from the repeat');
            Array.prototype.forEach.call(xfoos, function(x) {
              checkXFoo(x);
            });
            done();
          }
        });
      </script>
    </polymer-element>
    
    <x-bind-obj></x-bind-obj>
  </body>
</html>

{'fraction_non_alphanumeric': 0.16174792108266753, 'fraction_numerical': 0.0029349421164193705, 'mean_word_length': 1.781859410430839, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 85, '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': '5088439', 'n_tokens_mistral': 1832, 'n_tokens_neox': 1754, 'n_words': 406}