mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
commit
d4b53b32a6
@ -1,5 +1,4 @@
|
|||||||
node_modules/*
|
node_modules/*
|
||||||
bower_components/*
|
bower_components/*
|
||||||
test/*
|
|
||||||
src/**/demo/*
|
src/**/demo/*
|
||||||
src/**/experimental/*
|
src/**/experimental/*
|
||||||
|
@ -127,7 +127,7 @@ gulp.task('release', function(cb) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('lint', function() {
|
gulp.task('lint', function() {
|
||||||
return gulp.src('src/**/*.html')
|
return gulp.src(['src/**/*.html', 'test/unit/*.html'])
|
||||||
.pipe(eslint())
|
.pipe(eslint())
|
||||||
.pipe(eslint.format())
|
.pipe(eslint.format())
|
||||||
.pipe(eslint.failAfterError());
|
.pipe(eslint.failAfterError());
|
||||||
|
3
test/.eslintignore
Normal file
3
test/.eslintignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
assets/*
|
||||||
|
compat/*
|
||||||
|
smoke/*
|
10
test/.eslintrc.json
Normal file
10
test/.eslintrc.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"mocha": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"assert": true,
|
||||||
|
"sinon": true,
|
||||||
|
"WCT": true
|
||||||
|
}
|
||||||
|
}
|
@ -32,10 +32,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
/* global bind observer singleBound multiBound */
|
||||||
suite('basic', function() {
|
suite('basic', function() {
|
||||||
|
|
||||||
test('single selection', function() {
|
test('single selection', function() {
|
||||||
var el = singleConfigured;
|
var el = document.querySelector('#singleConfigured');
|
||||||
// Nothing selected
|
// Nothing selected
|
||||||
assert.strictEqual(el.selectedItem, null);
|
assert.strictEqual(el.selectedItem, null);
|
||||||
assert.isFalse(el.isSelected(el.items[0]));
|
assert.isFalse(el.isSelected(el.items[0]));
|
||||||
@ -76,7 +76,7 @@ suite('basic', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('multiple selection', function() {
|
test('multiple selection', function() {
|
||||||
var el = multiConfigured;
|
var el = document.querySelector('#multiConfigured');
|
||||||
// Nothing selected
|
// Nothing selected
|
||||||
assert.sameMembers(el.selected, []);
|
assert.sameMembers(el.selected, []);
|
||||||
assert.isFalse(el.isSelected(el.items[0]));
|
assert.isFalse(el.isSelected(el.items[0]));
|
||||||
@ -143,7 +143,7 @@ suite('basic', function() {
|
|||||||
};
|
};
|
||||||
singleBound.select(bind.items[2]);
|
singleBound.select(bind.items[2]);
|
||||||
assert.equal(called, true);
|
assert.equal(called, true);
|
||||||
observer.singleChanged = function(info) {};
|
observer.singleChanged = function() {};
|
||||||
});
|
});
|
||||||
|
|
||||||
test('single selection sub-property change', function() {
|
test('single selection sub-property change', function() {
|
||||||
@ -156,7 +156,7 @@ suite('basic', function() {
|
|||||||
};
|
};
|
||||||
bind.set(['items', 2, 'name'], 'test');
|
bind.set(['items', 2, 'name'], 'test');
|
||||||
assert.equal(called, true);
|
assert.equal(called, true);
|
||||||
observer.singleChanged = function(info) {};
|
observer.singleChanged = function() {};
|
||||||
});
|
});
|
||||||
|
|
||||||
test('single selection sub-property change after unshift', function() {
|
test('single selection sub-property change after unshift', function() {
|
||||||
@ -170,7 +170,7 @@ suite('basic', function() {
|
|||||||
bind.unshift('items', {name: 'zero'});
|
bind.unshift('items', {name: 'zero'});
|
||||||
bind.set(['items', 3, 'name'], 'test2');
|
bind.set(['items', 3, 'name'], 'test2');
|
||||||
assert.equal(called, true);
|
assert.equal(called, true);
|
||||||
observer.singleChanged = function(info) {};
|
observer.singleChanged = function() {};
|
||||||
});
|
});
|
||||||
|
|
||||||
test('multi selection notification', function() {
|
test('multi selection notification', function() {
|
||||||
@ -210,7 +210,7 @@ suite('basic', function() {
|
|||||||
};
|
};
|
||||||
multiBound.select(bind.items[0]);
|
multiBound.select(bind.items[0]);
|
||||||
assert.equal(called, true);
|
assert.equal(called, true);
|
||||||
observer.multiChanged = function(info) {};
|
observer.multiChanged = function() {};
|
||||||
});
|
});
|
||||||
|
|
||||||
test('multi selection sub-property change', function() {
|
test('multi selection sub-property change', function() {
|
||||||
@ -230,7 +230,7 @@ suite('basic', function() {
|
|||||||
};
|
};
|
||||||
bind.set(['items', 0, 'name'], 'test2');
|
bind.set(['items', 0, 'name'], 'test2');
|
||||||
assert.equal(called, true);
|
assert.equal(called, true);
|
||||||
observer.multiChanged = function(info) {};
|
observer.multiChanged = function() {};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
/* global Async */
|
||||||
setup(function() {
|
setup(function() {
|
||||||
window.Async = Polymer.Async;
|
window.Async = Polymer.Async;
|
||||||
});
|
});
|
||||||
@ -191,7 +191,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
called3++;
|
called3++;
|
||||||
};
|
};
|
||||||
var h1 = Async.run(callback1);
|
var h1 = Async.run(callback1);
|
||||||
var h2 = Async.run(callback2);
|
var h2 = Async.run(callback2); //eslint-disable-line no-unused-vars
|
||||||
var h3 = Async.run(callback3);
|
var h3 = Async.run(callback3);
|
||||||
Async.cancel(h1);
|
Async.cancel(h1);
|
||||||
Async.cancel(h3);
|
Async.cancel(h3);
|
||||||
@ -306,7 +306,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
called3++;
|
called3++;
|
||||||
};
|
};
|
||||||
var h1 = Async.run(callback1, 50);
|
var h1 = Async.run(callback1, 50);
|
||||||
var h2 = Async.run(callback2, 50);
|
var h2 = Async.run(callback2, 50); //eslint-disable-line no-unused-vars
|
||||||
var h3 = Async.run(callback3, 200);
|
var h3 = Async.run(callback3, 200);
|
||||||
Async.cancel(h1);
|
Async.cancel(h1);
|
||||||
Async.cancel(h3);
|
Async.cancel(h3);
|
||||||
|
@ -65,11 +65,11 @@
|
|||||||
propChangedCount: 0,
|
propChangedCount: 0,
|
||||||
attr1ChangedCount: 0,
|
attr1ChangedCount: 0,
|
||||||
|
|
||||||
propChanged: function(prop) {
|
propChanged: function() {
|
||||||
this.propChangedCount++;
|
this.propChangedCount++;
|
||||||
},
|
},
|
||||||
|
|
||||||
attr1Changed: function(prop) {
|
attr1Changed: function() {
|
||||||
this.attr1ChangedCount++;
|
this.attr1ChangedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
</x-reflect>
|
</x-reflect>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
/* global basicDefault basicConfigured compose reflectDefault reflectConfigured */
|
||||||
|
|
||||||
var configuredObject = {foo: 'bar', nested: {'meaning': 42}, arr: [0, 'foo', true]};
|
var configuredObject = {foo: 'bar', nested: {'meaning': 42}, arr: [0, 'foo', true]};
|
||||||
var configuredArray = [0, 'foo', true, {foo: 'bar'}];
|
var configuredArray = [0, 'foo', true, {foo: 'bar'}];
|
||||||
|
@ -29,6 +29,7 @@ var instance;
|
|||||||
|
|
||||||
setup(function() {
|
setup(function() {
|
||||||
// Ensure a clean environment for each test.
|
// Ensure a clean environment for each test.
|
||||||
|
/* global Base */
|
||||||
window.Base = Polymer.Base;
|
window.Base = Polymer.Base;
|
||||||
window.Child = Object.create(Base);
|
window.Child = Object.create(Base);
|
||||||
Child._registerFeatures = function() {};
|
Child._registerFeatures = function() {};
|
||||||
|
@ -90,7 +90,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
overridablePropertyB: {
|
overridablePropertyB: {
|
||||||
value: true
|
value: true
|
||||||
},
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
_simpleProperty: 'B',
|
_simpleProperty: 'B',
|
||||||
|
|
||||||
_disabledChanged: function(disabled) {
|
_disabledChanged: function(disabled) {
|
||||||
this.__disabled = disabled
|
this.__disabled = disabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
ready: function() {
|
ready: function() {
|
||||||
|
@ -132,7 +132,7 @@ suite('single-element binding effects', function() {
|
|||||||
|
|
||||||
test('NaN does not loop observers', function() {
|
test('NaN does not loop observers', function() {
|
||||||
el.clearObserverCounts();
|
el.clearObserverCounts();
|
||||||
el.addEventListener('notifierwithoutcomputing-changed', function(e) {
|
el.addEventListener('notifierwithoutcomputing-changed', function() {
|
||||||
if (el.observerCounts.notifierWithoutComputingChanged >= 3) {
|
if (el.observerCounts.notifierWithoutComputingChanged >= 3) {
|
||||||
throw new Error('infinite loop!');
|
throw new Error('infinite loop!');
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ suite('single-element binding effects', function() {
|
|||||||
|
|
||||||
test('computed property with multiple dependencies', function() {
|
test('computed property with multiple dependencies', function() {
|
||||||
var notified = 0;
|
var notified = 0;
|
||||||
el.addEventListener('computed-from-multiple-values-changed', function(e) {
|
el.addEventListener('computed-from-multiple-values-changed', function() {
|
||||||
notified++;
|
notified++;
|
||||||
});
|
});
|
||||||
el.sum1 = 10;
|
el.sum1 = 10;
|
||||||
@ -195,7 +195,7 @@ suite('single-element binding effects', function() {
|
|||||||
|
|
||||||
test('no read-only notification sent with assignment', function() {
|
test('no read-only notification sent with assignment', function() {
|
||||||
var notified = 0;
|
var notified = 0;
|
||||||
el.addEventListener('readonlyvalue-changed', function(e) {
|
el.addEventListener('readonlyvalue-changed', function() {
|
||||||
notified++;
|
notified++;
|
||||||
});
|
});
|
||||||
el.readonlyvalue = 47;
|
el.readonlyvalue = 47;
|
||||||
@ -663,7 +663,7 @@ suite('avoid non-bubbling event gotchas', function() {
|
|||||||
suite('warnings', function() {
|
suite('warnings', function() {
|
||||||
|
|
||||||
var el;
|
var el;
|
||||||
var warn;
|
var warn; //eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
setup(function() {
|
setup(function() {
|
||||||
el = document.createElement('x-basic');
|
el = document.createElement('x-basic');
|
||||||
|
@ -172,7 +172,7 @@
|
|||||||
value: 5
|
value: 5
|
||||||
},
|
},
|
||||||
attrValue: {
|
attrValue: {
|
||||||
value: 'attrValue',
|
value: 'attrValue'
|
||||||
},
|
},
|
||||||
attrNumber: {
|
attrNumber: {
|
||||||
value: '42'
|
value: '42'
|
||||||
|
@ -105,6 +105,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
}
|
}
|
||||||
|
|
||||||
suite('css-parse', function() {
|
suite('css-parse', function() {
|
||||||
|
var css, s, tree;
|
||||||
|
|
||||||
setup(function() {
|
setup(function() {
|
||||||
css = Polymer.CssParse;
|
css = Polymer.CssParse;
|
||||||
|
@ -21,6 +21,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
<input id="input" is="x-input">
|
<input id="input" is="x-input">
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
/* global input */
|
||||||
|
|
||||||
suite('custom-style late property definition', function() {
|
suite('custom-style late property definition', function() {
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
/* global earlyDomBind earlyBoundChild decEl1 decEl2 decDomBind z container needsHost*/
|
||||||
earlyDomBind.value = 'hi!';
|
earlyDomBind.value = 'hi!';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -182,7 +183,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(el.$.local.textContent, 'hey', 'dom-bind did not distribute');
|
assert.equal(el.$.local.textContent, 'hey', 'dom-bind did not distribute');
|
||||||
document.body.removeChild(el);
|
document.body.removeChild(el);
|
||||||
done();
|
done();
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('dom-bind distributed when inserted in element attached (flush)', function() {
|
test('dom-bind distributed when inserted in element attached (flush)', function() {
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
value: true
|
value: true
|
||||||
},
|
},
|
||||||
prop: {
|
prop: {
|
||||||
value: 'outer',
|
value: 'outer'
|
||||||
},
|
},
|
||||||
item: {
|
item: {
|
||||||
value: function() { return {prop: 'outerItem'}; }
|
value: function() { return {prop: 'outerItem'}; }
|
||||||
@ -141,13 +141,13 @@
|
|||||||
is: 'x-nested-if-individual',
|
is: 'x-nested-if-individual',
|
||||||
properties: {
|
properties: {
|
||||||
prop1: {
|
prop1: {
|
||||||
value: 'prop1',
|
value: 'prop1'
|
||||||
},
|
},
|
||||||
prop2: {
|
prop2: {
|
||||||
value: 'prop2',
|
value: 'prop2'
|
||||||
},
|
},
|
||||||
prop3: {
|
prop3: {
|
||||||
value: 'prop3',
|
value: 'prop3'
|
||||||
},
|
},
|
||||||
item: {
|
item: {
|
||||||
value: function() { return {prop: 'outerItem'}; }
|
value: function() { return {prop: 'outerItem'}; }
|
||||||
|
@ -72,7 +72,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
/* global configured individual unconfigured1 unconfigured2 inDocumentContainer inDocumentIf structuredContainer structuredDomIf structuredDomBind outerContainer innerContainer shouldBeRemoved toBeRemoved removalContainer*/
|
||||||
suite('nested pre-configured dom-if', function() {
|
suite('nested pre-configured dom-if', function() {
|
||||||
|
|
||||||
test('parent scope binding', function() {
|
test('parent scope binding', function() {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</dom-module>
|
</dom-module>
|
||||||
<script>
|
<script>
|
||||||
TestElement = Polymer({
|
window.TestElement = Polymer({
|
||||||
is: 'Test-element'
|
is: 'Test-element'
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
@ -52,9 +52,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('mixed case element creation', function() {
|
test('mixed case element creation', function() {
|
||||||
t = new TestElement();
|
var t = new TestElement(); //eslint-disable-line
|
||||||
assert.ok(t.$.content);
|
assert.ok(t.$.content);
|
||||||
})
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ window.data = [
|
|||||||
{ prop: 'prop-1-3-2' },
|
{ prop: 'prop-1-3-2' },
|
||||||
{ prop: 'prop-1-3-3' }
|
{ prop: 'prop-1-3-3' }
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ window.data = [
|
|||||||
{ prop: 'prop-2-3-2' },
|
{ prop: 'prop-2-3-2' },
|
||||||
{ prop: 'prop-2-3-3' }
|
{ prop: 'prop-2-3-3' }
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ window.data = [
|
|||||||
{ prop: 'prop-3-3-2' },
|
{ prop: 'prop-3-3-2' },
|
||||||
{ prop: 'prop-3-3-3' }
|
{ prop: 'prop-3-3-3' }
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@ -129,19 +129,19 @@ window.data = [
|
|||||||
notify: true
|
notify: true
|
||||||
},
|
},
|
||||||
inneraProp: {
|
inneraProp: {
|
||||||
notify: true,
|
notify: true
|
||||||
},
|
},
|
||||||
itemaProp: {
|
itemaProp: {
|
||||||
notify: true
|
notify: true
|
||||||
},
|
},
|
||||||
innerbProp: {
|
innerbProp: {
|
||||||
notify: true,
|
notify: true
|
||||||
},
|
},
|
||||||
itembProp: {
|
itembProp: {
|
||||||
notify: true
|
notify: true
|
||||||
},
|
},
|
||||||
innercProp: {
|
innercProp: {
|
||||||
notify: true,
|
notify: true
|
||||||
},
|
},
|
||||||
itemcProp: {
|
itemcProp: {
|
||||||
notify: true
|
notify: true
|
||||||
@ -167,19 +167,19 @@ window.data = [
|
|||||||
notify: true
|
notify: true
|
||||||
},
|
},
|
||||||
inneraProp: {
|
inneraProp: {
|
||||||
notify: true,
|
notify: true
|
||||||
},
|
},
|
||||||
itemaProp: {
|
itemaProp: {
|
||||||
notify: true
|
notify: true
|
||||||
},
|
},
|
||||||
innerbProp: {
|
innerbProp: {
|
||||||
notify: true,
|
notify: true
|
||||||
},
|
},
|
||||||
itembProp: {
|
itembProp: {
|
||||||
notify: true
|
notify: true
|
||||||
},
|
},
|
||||||
innercProp: {
|
innercProp: {
|
||||||
notify: true,
|
notify: true
|
||||||
},
|
},
|
||||||
itemcProp: {
|
itemcProp: {
|
||||||
notify: true
|
notify: true
|
||||||
@ -310,7 +310,7 @@ window.data = [
|
|||||||
value: window.data
|
value: window.data
|
||||||
},
|
},
|
||||||
prop: {
|
prop: {
|
||||||
value: 'outer',
|
value: 'outer'
|
||||||
},
|
},
|
||||||
item: {
|
item: {
|
||||||
value: function() { return {prop: 'outerItem'}; }
|
value: function() { return {prop: 'outerItem'}; }
|
||||||
@ -467,7 +467,7 @@ window.data = [
|
|||||||
created: function() {
|
created: function() {
|
||||||
var time = performance.now();
|
var time = performance.now();
|
||||||
time += 4;
|
time += 4;
|
||||||
while (performance.now() < time) {}
|
while (performance.now() < time) {} //eslint-disable-line no-empty
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -81,6 +81,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
/* global unconfigured1 unconfigured primitive limited inDocumentRepeater configured inDocumentContainer inDocumentContainerOrig unconfigured2 primitiveLarge simple:true model:true stamped:true chunked */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Expected:
|
Expected:
|
||||||
@ -105,9 +106,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
test('items must be array', function() {
|
test('items must be array', function() {
|
||||||
var warned = false;
|
var warned = false;
|
||||||
inDocumentRepeater._error = function(message) {
|
inDocumentRepeater._error = function(message) {
|
||||||
assert.match(message, /expected array/)
|
assert.match(message, /expected array/);
|
||||||
warned = true;
|
warned = true;
|
||||||
}
|
};
|
||||||
inDocumentRepeater.items = {};
|
inDocumentRepeater.items = {};
|
||||||
assert.equal(warned, true, 'should warn when items is not array');
|
assert.equal(warned, true, 'should warn when items is not array');
|
||||||
});
|
});
|
||||||
@ -648,7 +649,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
test('parent scope binding', function() {
|
test('parent scope binding', function() {
|
||||||
var stamped = Polymer.dom(unconfigured1.root).querySelectorAll('*:not(template)');
|
var stamped = Polymer.dom(unconfigured1.root).querySelectorAll('*:not(template)');
|
||||||
unconfigured1.prop = 'outer';
|
unconfigured1.prop = 'outer';
|
||||||
unconfigured1.item = {prop: 'outerItem'}
|
unconfigured1.item = {prop: 'outerItem'};
|
||||||
assert.equal(stamped[0].outerProp, 'outer');
|
assert.equal(stamped[0].outerProp, 'outer');
|
||||||
assert.equal(stamped[0].outerItemProp, 'outerItem');
|
assert.equal(stamped[0].outerItemProp, 'outerItem');
|
||||||
assert.equal(stamped[1].itemaProp, 'prop-1');
|
assert.equal(stamped[1].itemaProp, 'prop-1');
|
||||||
@ -3324,7 +3325,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(repeater1.renderedItemCount, 5, 'renderedItemCount is writable');
|
assert.equal(repeater1.renderedItemCount, 5, 'renderedItemCount is writable');
|
||||||
repeater1.filter = function(item) {
|
repeater1.filter = function(item) {
|
||||||
return (item != 'a' && item != 'e');
|
return (item != 'a' && item != 'e');
|
||||||
}
|
};
|
||||||
repeater1.render();
|
repeater1.render();
|
||||||
assert.equal(repeater1.renderedItemCount, 3, 'renderedItemCount incorrect after filter');
|
assert.equal(repeater1.renderedItemCount, 3, 'renderedItemCount incorrect after filter');
|
||||||
// reset repeater
|
// reset repeater
|
||||||
|
@ -73,7 +73,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
down: 'handler',
|
down: 'handler',
|
||||||
up: 'handler'
|
up: 'handler'
|
||||||
},
|
},
|
||||||
handler: function(e, detail) {
|
handler: function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -81,11 +81,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(obj.mousedown.downup, 2, 'mousedown downup');
|
assert.equal(obj.mousedown.downup, 2, 'mousedown downup');
|
||||||
assert.equal(obj.mousedown.track, 1, 'mousedown track');
|
assert.equal(obj.mousedown.track, 1, 'mousedown track');
|
||||||
assert.equal(obj.mousedown.tap, 1, 'mousedown tap');
|
assert.equal(obj.mousedown.tap, 1, 'mousedown tap');
|
||||||
assert.equal(obj.mousedown._count, 4, 'total mousedown')
|
assert.equal(obj.mousedown._count, 4, 'total mousedown');
|
||||||
assert.equal(obj.touchstart.downup, 2, 'touchstart downup');
|
assert.equal(obj.touchstart.downup, 2, 'touchstart downup');
|
||||||
assert.equal(obj.touchstart.tap, 1, 'touchstart tap');
|
assert.equal(obj.touchstart.tap, 1, 'touchstart tap');
|
||||||
assert.equal(obj.touchstart.track, 1, 'touchstart track');
|
assert.equal(obj.touchstart.track, 1, 'touchstart track');
|
||||||
assert.equal(obj.touchstart._count, 4, 'total touchstart')
|
assert.equal(obj.touchstart._count, 4, 'total touchstart');
|
||||||
assert.equal(obj.touchmove.track, 1, 'touchmove track');
|
assert.equal(obj.touchmove.track, 1, 'touchmove track');
|
||||||
assert.equal(obj.touchmove._count, 1, 'total touchmove');
|
assert.equal(obj.touchmove._count, 1, 'total touchmove');
|
||||||
assert.equal(obj.touchend.downup, 2, 'touchend downup');
|
assert.equal(obj.touchend.downup, 2, 'touchend downup');
|
||||||
@ -100,17 +100,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(obj.mousedown.downup, 2, 'mousedown downup');
|
assert.equal(obj.mousedown.downup, 2, 'mousedown downup');
|
||||||
assert.equal(obj.mousedown.track, 1, 'mousedown track');
|
assert.equal(obj.mousedown.track, 1, 'mousedown track');
|
||||||
assert.equal(obj.mousedown.tap, 1, 'mousedown tap');
|
assert.equal(obj.mousedown.tap, 1, 'mousedown tap');
|
||||||
assert.equal(obj.mousedown._count, 4, 'total mousedown')
|
assert.equal(obj.mousedown._count, 4, 'total mousedown');
|
||||||
assert.equal(obj.touchstart.downup, 2, 'touchstart downup');
|
assert.equal(obj.touchstart.downup, 2, 'touchstart downup');
|
||||||
assert.equal(obj.touchstart.tap, 1, 'touchstart tap');
|
assert.equal(obj.touchstart.tap, 1, 'touchstart tap');
|
||||||
assert.equal(obj.touchstart.track, 1, 'touchstart track');
|
assert.equal(obj.touchstart.track, 1, 'touchstart track');
|
||||||
assert.equal(obj.touchstart._count, 4, 'total touchstart')
|
assert.equal(obj.touchstart._count, 4, 'total touchstart');
|
||||||
assert.equal(obj.touchmove.track, 1, 'touchmove track');
|
assert.equal(obj.touchmove.track, 1, 'touchmove track');
|
||||||
assert.equal(obj.touchmove._count, 1, 'total touchmove');
|
assert.equal(obj.touchmove._count, 1, 'total touchmove');
|
||||||
assert.equal(obj.touchend.downup, 2, 'touchend downup');
|
assert.equal(obj.touchend.downup, 2, 'touchend downup');
|
||||||
assert.equal(obj.touchend.track, 1, 'touchend track');
|
assert.equal(obj.touchend.track, 1, 'touchend track');
|
||||||
assert.equal(obj.touchend.tap, 1, 'touchend tap');
|
assert.equal(obj.touchend.tap, 1, 'touchend tap');
|
||||||
assert.equal(obj.touchend._count, 4, 'total touchend');;
|
assert.equal(obj.touchend._count, 4, 'total touchend');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('dynamic', function() {
|
test('dynamic', function() {
|
||||||
@ -142,7 +142,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(obj.touchstart.downup, 0, 'touchstart downup');
|
assert.equal(obj.touchstart.downup, 0, 'touchstart downup');
|
||||||
assert.equal(obj.touchstart._count, 0, 'total touchstart');
|
assert.equal(obj.touchstart._count, 0, 'total touchstart');
|
||||||
assert.equal(obj.touchmove.track, 0, 'touchmove track');
|
assert.equal(obj.touchmove.track, 0, 'touchmove track');
|
||||||
assert.equal(obj.touchmove._count, 0, 'total touchmove')
|
assert.equal(obj.touchmove._count, 0, 'total touchmove');
|
||||||
assert.equal(obj.touchstart.tap, 0, 'touchstart tap');
|
assert.equal(obj.touchstart.tap, 0, 'touchstart tap');
|
||||||
assert.equal(obj.touchend.downup, 0, 'touchend downup');
|
assert.equal(obj.touchend.downup, 0, 'touchend downup');
|
||||||
assert.equal(obj.touchend.track, 0, 'touchend track');
|
assert.equal(obj.touchend.track, 0, 'touchend track');
|
||||||
@ -164,7 +164,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(obj.touchstart.downup, 0, 'touchstart downup');
|
assert.equal(obj.touchstart.downup, 0, 'touchstart downup');
|
||||||
assert.equal(obj.touchstart._count, 0, 'total touchstart');
|
assert.equal(obj.touchstart._count, 0, 'total touchstart');
|
||||||
assert.equal(obj.touchmove.track, 0, 'touchmove track');
|
assert.equal(obj.touchmove.track, 0, 'touchmove track');
|
||||||
assert.equal(obj.touchmove._count, 0, 'total touchmove')
|
assert.equal(obj.touchmove._count, 0, 'total touchmove');
|
||||||
assert.equal(obj.touchstart.tap, 0, 'touchstart tap');
|
assert.equal(obj.touchstart.tap, 0, 'touchstart tap');
|
||||||
assert.equal(obj.touchend.downup, 0, 'touchend downup');
|
assert.equal(obj.touchend.downup, 0, 'touchend downup');
|
||||||
assert.equal(obj.touchend.track, 0, 'touchend track');
|
assert.equal(obj.touchend.track, 0, 'touchend track');
|
||||||
@ -202,7 +202,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
test('target finding returns null outside the window', function() {
|
test('target finding returns null outside the window', function() {
|
||||||
var actual = Polymer.Gestures.deepTargetFind(-1, -1);
|
var actual = Polymer.Gestures.deepTargetFind(-1, -1);
|
||||||
assert.equal(actual, null);
|
assert.equal(actual, null);
|
||||||
})
|
});
|
||||||
|
|
||||||
test('find the div in document', function() {
|
test('find the div in document', function() {
|
||||||
var x = divLocation.left, y = divLocation.top;
|
var x = divLocation.left, y = divLocation.top;
|
||||||
|
@ -14,6 +14,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
<script src="../../../web-component-tester/browser.js"></script>
|
<script src="../../../web-component-tester/browser.js"></script>
|
||||||
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
|
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
/* global origOwnProps:true */
|
||||||
window.origOwnProps = Object.getOwnPropertyNames(window).reduce(function(props, prop) {
|
window.origOwnProps = Object.getOwnPropertyNames(window).reduce(function(props, prop) {
|
||||||
return props[prop] = true && props;
|
return props[prop] = true && props;
|
||||||
}, {});
|
}, {});
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
},
|
},
|
||||||
observers: [
|
observers: [
|
||||||
'objSubpathChanged(obj.*)',
|
'objSubpathChanged(obj.*)',
|
||||||
'objValueChanged(obj.value)',
|
'objValueChanged(obj.value)'
|
||||||
],
|
],
|
||||||
created: function() {
|
created: function() {
|
||||||
this.observerCounts = {
|
this.observerCounts = {
|
||||||
@ -51,7 +51,7 @@
|
|||||||
objValueChanged: function(value) {
|
objValueChanged: function(value) {
|
||||||
this.observerCounts.objValueChanged++;
|
this.observerCounts.objValueChanged++;
|
||||||
assert.equal(this.obj.value, value);
|
assert.equal(this.obj.value, value);
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</dom-module>
|
</dom-module>
|
||||||
@ -71,7 +71,7 @@
|
|||||||
},
|
},
|
||||||
observers: [
|
observers: [
|
||||||
'objSubpathChanged(obj.*)',
|
'objSubpathChanged(obj.*)',
|
||||||
'objValueChanged(obj.value)',
|
'objValueChanged(obj.value)'
|
||||||
],
|
],
|
||||||
created: function() {
|
created: function() {
|
||||||
this.observerCounts = {
|
this.observerCounts = {
|
||||||
@ -96,7 +96,7 @@
|
|||||||
objValueChanged: function(value) {
|
objValueChanged: function(value) {
|
||||||
this.observerCounts.objValueChanged++;
|
this.observerCounts.objValueChanged++;
|
||||||
assert.equal(this.obj.value, value);
|
assert.equal(this.obj.value, value);
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</dom-module>
|
</dom-module>
|
||||||
@ -211,7 +211,7 @@
|
|||||||
'arrayChanged keySplices incorrect');
|
'arrayChanged keySplices incorrect');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
arrayChangedDeep: function(info) { },
|
arrayChangedDeep: function() { },
|
||||||
arrayNoCollChanged: function(splices) {
|
arrayNoCollChanged: function(splices) {
|
||||||
this.observerCounts.arrayNoCollChanged++;
|
this.observerCounts.arrayNoCollChanged++;
|
||||||
if (this.arrayNoColl.length) {
|
if (this.arrayNoColl.length) {
|
||||||
@ -221,7 +221,7 @@
|
|||||||
'arrayNoCollChanged indexSplices incorrect');
|
'arrayNoCollChanged indexSplices incorrect');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
arrayOrPropChanged: function(prop, splices) {
|
arrayOrPropChanged: function(prop) {
|
||||||
this.observerCounts.arrayOrPropChanged++;
|
this.observerCounts.arrayOrPropChanged++;
|
||||||
assert.equal(prop, this.prop);
|
assert.equal(prop, this.prop);
|
||||||
},
|
},
|
||||||
|
@ -813,7 +813,7 @@ suite('path API', function() {
|
|||||||
el.arrayChanged = nop;
|
el.arrayChanged = nop;
|
||||||
el.array = ['orig1', 'orig2', 'orig3'];
|
el.array = ['orig1', 'orig2', 'orig3'];
|
||||||
Polymer.Collection.get(el.array);
|
Polymer.Collection.get(el.array);
|
||||||
el.arrayChanged = function(change) {
|
el.arrayChanged = function() {
|
||||||
throw new Error("should not notify");
|
throw new Error("should not notify");
|
||||||
};
|
};
|
||||||
var ret = el.push('array');
|
var ret = el.push('array');
|
||||||
@ -828,7 +828,7 @@ suite('path API', function() {
|
|||||||
el.arrayChanged = nop;
|
el.arrayChanged = nop;
|
||||||
el.array = [];
|
el.array = [];
|
||||||
Polymer.Collection.get(el.array);
|
Polymer.Collection.get(el.array);
|
||||||
el.arrayChanged = function(change) {
|
el.arrayChanged = function() {
|
||||||
throw new Error("should not notify");
|
throw new Error("should not notify");
|
||||||
};
|
};
|
||||||
var ret = el.pop('array');
|
var ret = el.pop('array');
|
||||||
@ -840,8 +840,7 @@ suite('path API', function() {
|
|||||||
el.arrayChanged = nop;
|
el.arrayChanged = nop;
|
||||||
el.array = ['orig1', 'orig2', 'orig3'];
|
el.array = ['orig1', 'orig2', 'orig3'];
|
||||||
Polymer.Collection.get(el.array);
|
Polymer.Collection.get(el.array);
|
||||||
var key = el.array.length;
|
el.arrayChanged = function() {
|
||||||
el.arrayChanged = function(change) {
|
|
||||||
throw new Error("should not notify");
|
throw new Error("should not notify");
|
||||||
};
|
};
|
||||||
var ret = el.unshift('array');
|
var ret = el.unshift('array');
|
||||||
@ -856,7 +855,7 @@ suite('path API', function() {
|
|||||||
el.arrayChanged = nop;
|
el.arrayChanged = nop;
|
||||||
el.array = [];
|
el.array = [];
|
||||||
Polymer.Collection.get(el.array);
|
Polymer.Collection.get(el.array);
|
||||||
el.arrayChanged = function(change) {
|
el.arrayChanged = function() {
|
||||||
throw new Error("should not notify");
|
throw new Error("should not notify");
|
||||||
};
|
};
|
||||||
var ret = el.shift('array');
|
var ret = el.shift('array');
|
||||||
@ -868,9 +867,8 @@ suite('path API', function() {
|
|||||||
test('corner: no-op splice array', function() {
|
test('corner: no-op splice array', function() {
|
||||||
el.arrayChanged = nop;
|
el.arrayChanged = nop;
|
||||||
el.array = ['orig1', 'orig2', 'orig3'];
|
el.array = ['orig1', 'orig2', 'orig3'];
|
||||||
var key = el.array.length;
|
|
||||||
Polymer.Collection.get(el.array);
|
Polymer.Collection.get(el.array);
|
||||||
el.arrayChanged = function(change) {
|
el.arrayChanged = function() {
|
||||||
throw new Error("should not notify");
|
throw new Error("should not notify");
|
||||||
};
|
};
|
||||||
var ret = el.splice('array');
|
var ret = el.splice('array');
|
||||||
|
@ -306,7 +306,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
// NOTE: these tests are mostly for Shady but running them on Shadow DOM
|
// NOTE: these tests are mostly for Shady but running them on Shadow DOM
|
||||||
// ensures Polymer.dom functions correctly under Shadow DOM.
|
// ensures Polymer.dom functions correctly under Shadow DOM.
|
||||||
usingShady = !Polymer.Settings.useNativeShadow;
|
usingShady = !Polymer.Settings.useNativeShadow;
|
||||||
})
|
});
|
||||||
|
|
||||||
suite('appendChild & removeChild of <content>', function() {
|
suite('appendChild & removeChild of <content>', function() {
|
||||||
|
|
||||||
@ -988,6 +988,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var s1 = document.createElement('span');
|
var s1 = document.createElement('span');
|
||||||
var s2 = document.createElement('span');
|
var s2 = document.createElement('span');
|
||||||
var s3 = document.createElement('span');
|
var s3 = document.createElement('span');
|
||||||
|
var composedChildren;
|
||||||
frag.appendChild(s1);
|
frag.appendChild(s1);
|
||||||
frag.appendChild(s2);
|
frag.appendChild(s2);
|
||||||
frag.appendChild(s3);
|
frag.appendChild(s3);
|
||||||
@ -1000,7 +1001,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(host.$.distWrapper.children[1], s2);
|
assert.equal(host.$.distWrapper.children[1], s2);
|
||||||
assert.equal(host.$.distWrapper.children[2], s3);
|
assert.equal(host.$.distWrapper.children[2], s3);
|
||||||
assert.equal(host.$.distWrapper.children[3], s0);
|
assert.equal(host.$.distWrapper.children[3], s0);
|
||||||
var composedChildren = Polymer.TreeApi.Composed.getChildNodes(host.$.distWrapper);
|
composedChildren = Polymer.TreeApi.Composed.getChildNodes(host.$.distWrapper);
|
||||||
assert.equal(composedChildren.length, 4);
|
assert.equal(composedChildren.length, 4);
|
||||||
assert.equal(composedChildren[0], s1);
|
assert.equal(composedChildren[0], s1);
|
||||||
assert.equal(composedChildren[1], s2);
|
assert.equal(composedChildren[1], s2);
|
||||||
@ -1013,7 +1014,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
if (host.shadyRoot) {
|
if (host.shadyRoot) {
|
||||||
assert.equal(host.$.distWrapper.children.length, 1);
|
assert.equal(host.$.distWrapper.children.length, 1);
|
||||||
var composedChildren = Polymer.TreeApi.Composed.getChildNodes(host.$.distWrapper);
|
composedChildren = Polymer.TreeApi.Composed.getChildNodes(host.$.distWrapper);
|
||||||
assert.equal(composedChildren.length, 1);
|
assert.equal(composedChildren.length, 1);
|
||||||
assert.equal(composedChildren[0], s0);
|
assert.equal(composedChildren[0], s0);
|
||||||
}
|
}
|
||||||
@ -1027,6 +1028,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var s1 = document.createElement('span');
|
var s1 = document.createElement('span');
|
||||||
var s2 = document.createElement('span');
|
var s2 = document.createElement('span');
|
||||||
var s3 = document.createElement('span');
|
var s3 = document.createElement('span');
|
||||||
|
var composedChildren;
|
||||||
frag.appendChild(s1);
|
frag.appendChild(s1);
|
||||||
frag.appendChild(s2);
|
frag.appendChild(s2);
|
||||||
frag.appendChild(s3);
|
frag.appendChild(s3);
|
||||||
@ -1039,7 +1041,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(host.$.distWrapper.children[1], s2);
|
assert.equal(host.$.distWrapper.children[1], s2);
|
||||||
assert.equal(host.$.distWrapper.children[2], s3);
|
assert.equal(host.$.distWrapper.children[2], s3);
|
||||||
assert.equal(host.$.distWrapper.children[3], s0);
|
assert.equal(host.$.distWrapper.children[3], s0);
|
||||||
var composedChildren = Polymer.TreeApi.Composed.getChildNodes(host.$.distWrapper);
|
composedChildren = Polymer.TreeApi.Composed.getChildNodes(host.$.distWrapper);
|
||||||
assert.equal(composedChildren.length, 4);
|
assert.equal(composedChildren.length, 4);
|
||||||
assert.equal(composedChildren[0], s1);
|
assert.equal(composedChildren[0], s1);
|
||||||
assert.equal(composedChildren[1], s2);
|
assert.equal(composedChildren[1], s2);
|
||||||
@ -1052,7 +1054,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
if (host.shadyRoot) {
|
if (host.shadyRoot) {
|
||||||
assert.equal(host.$.distWrapper.children.length, 1);
|
assert.equal(host.$.distWrapper.children.length, 1);
|
||||||
var composedChildren = Polymer.TreeApi.Composed.getChildNodes(host.$.distWrapper);
|
composedChildren = Polymer.TreeApi.Composed.getChildNodes(host.$.distWrapper);
|
||||||
assert.equal(composedChildren.length, 1);
|
assert.equal(composedChildren.length, 1);
|
||||||
assert.equal(composedChildren[0], s0);
|
assert.equal(composedChildren[0], s0);
|
||||||
}
|
}
|
||||||
@ -1139,7 +1141,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
test('moving children between distributing host and fragment', function() {
|
test('moving children between distributing host and fragment', function() {
|
||||||
var h1 = document.createElement('x-dist');
|
var h1 = document.createElement('x-dist');
|
||||||
var h2 = document.createDocumentFragment();;
|
var h2 = document.createDocumentFragment();
|
||||||
document.body.appendChild(h1);
|
document.body.appendChild(h1);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
var d = document.createElement('div');
|
var d = document.createElement('div');
|
||||||
@ -1174,7 +1176,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
div.innerHTML = '<x-dist><div></div></x-dist>';
|
div.innerHTML = '<x-dist><div></div></x-dist>';
|
||||||
var h1 = div.firstChild;
|
var h1 = div.firstChild;
|
||||||
var h2 = document.createDocumentFragment();;
|
var h2 = document.createDocumentFragment();
|
||||||
document.body.appendChild(h1);
|
document.body.appendChild(h1);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
var d = Polymer.dom(h1).firstElementChild;
|
var d = Polymer.dom(h1).firstElementChild;
|
||||||
@ -1285,7 +1287,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
test('moving children between distributing host with deep insertion and fragment', function() {
|
test('moving children between distributing host with deep insertion and fragment', function() {
|
||||||
var h1 = document.createElement('x-dist-inside-deep-tree');
|
var h1 = document.createElement('x-dist-inside-deep-tree');
|
||||||
var h2 = document.createDocumentFragment();;
|
var h2 = document.createDocumentFragment();
|
||||||
document.body.appendChild(h1);
|
document.body.appendChild(h1);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
var d = document.createElement('div');
|
var d = document.createElement('div');
|
||||||
@ -1320,7 +1322,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
div.innerHTML = '<x-dist-inside-deep-tree><div></div></x-dist-inside-deep-tree>';
|
div.innerHTML = '<x-dist-inside-deep-tree><div></div></x-dist-inside-deep-tree>';
|
||||||
var h1 = div.firstChild;
|
var h1 = div.firstChild;
|
||||||
var h2 = document.createDocumentFragment();;
|
var h2 = document.createDocumentFragment();
|
||||||
document.body.appendChild(h1);
|
document.body.appendChild(h1);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
var d = Polymer.dom(h1).firstElementChild;
|
var d = Polymer.dom(h1).firstElementChild;
|
||||||
@ -1352,7 +1354,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
test('moving children between distributing host with shallow insertion and fragment', function() {
|
test('moving children between distributing host with shallow insertion and fragment', function() {
|
||||||
var h1 = document.createElement('x-dist-simple');
|
var h1 = document.createElement('x-dist-simple');
|
||||||
var h2 = document.createDocumentFragment();;
|
var h2 = document.createDocumentFragment();
|
||||||
document.body.appendChild(h1);
|
document.body.appendChild(h1);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
var d = document.createElement('div');
|
var d = document.createElement('div');
|
||||||
@ -1730,7 +1732,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
el.$.staticIf.if = true;
|
el.$.staticIf.if = true;
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
assert.ok(Polymer.dom(el.root).querySelector('#static'));
|
assert.ok(Polymer.dom(el.root).querySelector('#static'));
|
||||||
var ip = Polymer.dom(el.root).querySelector('content');
|
ip = Polymer.dom(el.root).querySelector('content');
|
||||||
assert.ok(ip);
|
assert.ok(ip);
|
||||||
assert.equal(Polymer.dom(ip).getDistributedNodes()[0], c1);
|
assert.equal(Polymer.dom(ip).getDistributedNodes()[0], c1);
|
||||||
if (el.shadyRoot) {
|
if (el.shadyRoot) {
|
||||||
|
@ -256,7 +256,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
var recordedInfo, elAddedInObserver;
|
var recordedInfo, elAddedInObserver;
|
||||||
var observerCallCount = 0;
|
var observerCallCount = 0;
|
||||||
var handle = Polymer.dom(el).observeNodes(function(info) {
|
Polymer.dom(el).observeNodes(function(info) {
|
||||||
if (Polymer.dom(info.target).childNodes.length < 5) {
|
if (Polymer.dom(info.target).childNodes.length < 5) {
|
||||||
elAddedInObserver = document.createElement('div');
|
elAddedInObserver = document.createElement('div');
|
||||||
Polymer.dom(info.target).appendChild(elAddedInObserver);
|
Polymer.dom(info.target).appendChild(elAddedInObserver);
|
||||||
@ -309,7 +309,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
Polymer.dom(el).removeChild(d);
|
Polymer.dom(el).removeChild(d);
|
||||||
Polymer.dom(el).removeChild(d1);
|
Polymer.dom(el).removeChild(d1);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
assert.notEqual(nodes.length, el.getEffectiveChildNodes().length)
|
assert.notEqual(nodes.length, el.getEffectiveChildNodes().length);
|
||||||
document.body.removeChild(el);
|
document.body.removeChild(el);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -486,7 +486,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var el = document.createElement('test-content1');
|
var el = document.createElement('test-content1');
|
||||||
document.body.appendChild(el);
|
document.body.appendChild(el);
|
||||||
var recorded;
|
var recorded;
|
||||||
var handle = Polymer.dom(el.$.content).observeNodes(function(info) {
|
Polymer.dom(el.$.content).observeNodes(function(info) {
|
||||||
recorded = info;
|
recorded = info;
|
||||||
});
|
});
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
@ -518,7 +518,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var el = document.createElement('staticDiv');
|
var el = document.createElement('staticDiv');
|
||||||
document.body.appendChild(el);
|
document.body.appendChild(el);
|
||||||
var recorded;
|
var recorded;
|
||||||
var handle = Polymer.dom(el).observeNodes(function(info) {
|
Polymer.dom(el).observeNodes(function(info) {
|
||||||
recorded = info;
|
recorded = info;
|
||||||
});
|
});
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
@ -779,15 +779,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var el = document.createElement('test-content1');
|
var el = document.createElement('test-content1');
|
||||||
document.body.appendChild(el);
|
document.body.appendChild(el);
|
||||||
var r1 = 0;
|
var r1 = 0;
|
||||||
var h1 = Polymer.dom(el.$.content).observeNodes(function(info) {
|
var h1 = Polymer.dom(el.$.content).observeNodes(function() {
|
||||||
r1++;
|
r1++;
|
||||||
});
|
});
|
||||||
var r2 = 0;
|
var r2 = 0;
|
||||||
var h2 = Polymer.dom(el.$.content).observeNodes(function(info) {
|
var h2 = Polymer.dom(el.$.content).observeNodes(function() {
|
||||||
r2++;
|
r2++;
|
||||||
});
|
});
|
||||||
var r3 = 0;
|
var r3 = 0;
|
||||||
var h3 = Polymer.dom(el.$.content).observeNodes(function(info) {
|
var h3 = Polymer.dom(el.$.content).observeNodes(function() {
|
||||||
r3++;
|
r3++;
|
||||||
});
|
});
|
||||||
// add
|
// add
|
||||||
@ -798,21 +798,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(r2, 1);
|
assert.equal(r2, 1);
|
||||||
assert.equal(r3, 1);
|
assert.equal(r3, 1);
|
||||||
Polymer.dom(el.$.content).unobserveNodes(h1);
|
Polymer.dom(el.$.content).unobserveNodes(h1);
|
||||||
var d = document.createElement('div');
|
d = document.createElement('div');
|
||||||
Polymer.dom(el).appendChild(d);
|
Polymer.dom(el).appendChild(d);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
assert.equal(r1, 1);
|
assert.equal(r1, 1);
|
||||||
assert.equal(r2, 2);
|
assert.equal(r2, 2);
|
||||||
assert.equal(r3, 2);
|
assert.equal(r3, 2);
|
||||||
Polymer.dom(el.$.content).unobserveNodes(h2);
|
Polymer.dom(el.$.content).unobserveNodes(h2);
|
||||||
var d = document.createElement('div');
|
d = document.createElement('div');
|
||||||
Polymer.dom(el).appendChild(d);
|
Polymer.dom(el).appendChild(d);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
assert.equal(r1, 1);
|
assert.equal(r1, 1);
|
||||||
assert.equal(r2, 2);
|
assert.equal(r2, 2);
|
||||||
assert.equal(r3, 3);
|
assert.equal(r3, 3);
|
||||||
Polymer.dom(el.$.content).unobserveNodes(h3);
|
Polymer.dom(el.$.content).unobserveNodes(h3);
|
||||||
var d = document.createElement('div');
|
d = document.createElement('div');
|
||||||
Polymer.dom(el).appendChild(d);
|
Polymer.dom(el).appendChild(d);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
assert.equal(r1, 1);
|
assert.equal(r1, 1);
|
||||||
@ -825,28 +825,28 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(r1, 2);
|
assert.equal(r1, 2);
|
||||||
assert.equal(r2, 3);
|
assert.equal(r2, 3);
|
||||||
assert.equal(r3, 4);
|
assert.equal(r3, 4);
|
||||||
var d = document.createElement('div');
|
d = document.createElement('div');
|
||||||
Polymer.dom(el).appendChild(d);
|
Polymer.dom(el).appendChild(d);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
assert.equal(r1, 3);
|
assert.equal(r1, 3);
|
||||||
assert.equal(r2, 4);
|
assert.equal(r2, 4);
|
||||||
assert.equal(r3, 5);
|
assert.equal(r3, 5);
|
||||||
Polymer.dom(el.$.content).unobserveNodes(h3);
|
Polymer.dom(el.$.content).unobserveNodes(h3);
|
||||||
var d = document.createElement('div');
|
d = document.createElement('div');
|
||||||
Polymer.dom(el).appendChild(d);
|
Polymer.dom(el).appendChild(d);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
assert.equal(r1, 4);
|
assert.equal(r1, 4);
|
||||||
assert.equal(r2, 5);
|
assert.equal(r2, 5);
|
||||||
assert.equal(r3, 5);
|
assert.equal(r3, 5);
|
||||||
Polymer.dom(el.$.content).unobserveNodes(h2);
|
Polymer.dom(el.$.content).unobserveNodes(h2);
|
||||||
var d = document.createElement('div');
|
d = document.createElement('div');
|
||||||
Polymer.dom(el).appendChild(d);
|
Polymer.dom(el).appendChild(d);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
assert.equal(r1, 5);
|
assert.equal(r1, 5);
|
||||||
assert.equal(r2, 5);
|
assert.equal(r2, 5);
|
||||||
assert.equal(r3, 5);
|
assert.equal(r3, 5);
|
||||||
Polymer.dom(el.$.content).unobserveNodes(h1);
|
Polymer.dom(el.$.content).unobserveNodes(h1);
|
||||||
var d = document.createElement('div');
|
d = document.createElement('div');
|
||||||
Polymer.dom(el).appendChild(d);
|
Polymer.dom(el).appendChild(d);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
assert.equal(r1, 5);
|
assert.equal(r1, 5);
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
<script>
|
<script>
|
||||||
|
/* global chai */
|
||||||
|
var assert = chai.assert;
|
||||||
var configureList = [];
|
var configureList = [];
|
||||||
var readyList = [];
|
var readyList = [];
|
||||||
|
|
||||||
function clearTestLists() {
|
function clearTestLists() { //eslint-disable-line
|
||||||
configureList = [];
|
configureList = [];
|
||||||
readyList = [];
|
readyList = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var readyBehavior = {
|
var readyBehavior = {
|
||||||
moniker: function() {
|
moniker: function() {
|
||||||
return this.is + (this.id ? '#' + this.id : '')
|
return this.is + (this.id ? '#' + this.id : '');
|
||||||
},
|
},
|
||||||
// use private, stateful, method for testing purposes
|
// use private, stateful, method for testing purposes
|
||||||
_configure: function() {
|
_configure: function() {
|
||||||
chai.assert.isTrue(!this.isAttached, 'Element should not be attached when configured.');
|
assert.isTrue(!this.isAttached, 'Element should not be attached when configured.');
|
||||||
configureList.push(this.moniker());
|
configureList.push(this.moniker());
|
||||||
},
|
},
|
||||||
ready: function() {
|
ready: function() {
|
||||||
@ -21,7 +23,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
attached: function() {
|
attached: function() {
|
||||||
chai.assert.isTrue(this._readied, 'Element not ready when attached');
|
assert.isTrue(this._readied, 'Element not ready when attached');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
suite('ready', function() {
|
suite('ready', function() {
|
||||||
|
/* globals configureList readyList clearTestLists */
|
||||||
|
|
||||||
var configure = ['x-ready', 'x-zot#a', 'x-zot#b', 'x-zot#c', 'x-zot#d', 'x-foo#foo', 'x-bar#bar1', 'x-zot', 'x-bar#bar2', 'x-zot'];
|
var configure = ['x-ready', 'x-zot#a', 'x-zot#b', 'x-zot#c', 'x-zot#d', 'x-foo#foo', 'x-bar#bar1', 'x-zot', 'x-bar#bar2', 'x-zot'];
|
||||||
var ready = ['x-zot#a', 'x-zot#b', 'x-zot#c', 'x-zot#d', 'x-zot', 'x-bar#bar1', 'x-zot', 'x-bar#bar2', 'x-foo#foo', 'x-ready'];
|
var ready = ['x-zot#a', 'x-zot#b', 'x-zot#c', 'x-zot#d', 'x-zot', 'x-bar#bar1', 'x-zot', 'x-bar#bar2', 'x-foo#foo', 'x-ready'];
|
||||||
|
@ -123,7 +123,7 @@ test('Reproject', function() {
|
|||||||
'a: <content select=a></content>b: <content select=b></content>');
|
'a: <content select=a></content>b: <content select=b></content>');
|
||||||
var textNodeA = p.shadyRoot.firstChild;
|
var textNodeA = p.shadyRoot.firstChild;
|
||||||
var contentA = p.shadyRoot.childNodes[1];
|
var contentA = p.shadyRoot.childNodes[1];
|
||||||
var textNodeB = p.shadyRoot.childNodes[2]
|
var textNodeB = p.shadyRoot.childNodes[2];
|
||||||
var contentB = p.shadyRoot.childNodes[3];
|
var contentB = p.shadyRoot.childNodes[3];
|
||||||
|
|
||||||
function testRender() {
|
function testRender() {
|
||||||
@ -360,7 +360,6 @@ suite('Mutate light DOM', function() {
|
|||||||
test('replaceChild - mutate host', function() {
|
test('replaceChild - mutate host', function() {
|
||||||
var host = document.createElement('x-content-test');
|
var host = document.createElement('x-content-test');
|
||||||
setInnerHTML(host, '<a>Hello</a>');
|
setInnerHTML(host, '<a>Hello</a>');
|
||||||
var a = host.firstChild;
|
|
||||||
|
|
||||||
syncLightDOM(host);
|
syncLightDOM(host);
|
||||||
setRootInnerHTML(host.shadyRoot, '<content></content>');
|
setRootInnerHTML(host.shadyRoot, '<content></content>');
|
||||||
@ -460,7 +459,7 @@ function setInnerHTML(node, value) {
|
|||||||
var temp = node.ownerDocument.createElement('div');
|
var temp = node.ownerDocument.createElement('div');
|
||||||
temp.innerHTML = value;
|
temp.innerHTML = value;
|
||||||
var firstChild;
|
var firstChild;
|
||||||
while (firstChild = temp.firstChild) {
|
while ((firstChild = temp.firstChild)) {
|
||||||
nativeAppendChild.call(node, firstChild);
|
nativeAppendChild.call(node, firstChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var proto = Object.create(HTMLElement.prototype);
|
var proto = Object.create(HTMLElement.prototype);
|
||||||
proto.createdCallback = function() {
|
proto.createdCallback = function() {
|
||||||
this.root = this.createShadowRoot();
|
this.root = this.createShadowRoot();
|
||||||
}
|
};
|
||||||
document.registerElement('unknown-host', {prototype: proto});
|
document.registerElement('unknown-host', {prototype: proto});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -89,10 +89,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
assert.equal(computed['border-top-width'], value, 'computed style incorrect');
|
assert.equal(computed['border-top-width'], value, 'computed style incorrect');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
function assertStylePropertyValue(properties, name, includeValue) {
|
function assertStylePropertyValue(properties, name, includeValue) {
|
||||||
assert.property(properties, name);
|
assert.property(properties, name);
|
||||||
assert.include(properties[name], includeValue);
|
assert.include(properties[name], includeValue);
|
||||||
}
|
}
|
||||||
|
/* eslint-enable no-unused-vars */
|
||||||
|
|
||||||
test('element in top level unknown host styled via property defaults', function() {
|
test('element in top level unknown host styled via property defaults', function() {
|
||||||
var host = document.createElement('unknown-host');
|
var host = document.createElement('unknown-host');
|
||||||
@ -118,4 +120,3 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
suite('templatizer client and template separate', function() {
|
suite('templatizer client and template separate', function() {
|
||||||
|
/* global childA childB */
|
||||||
|
|
||||||
var host;
|
var host;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var elt1 = document.querySelector('#elt1');
|
var elt1 = document.querySelector('#elt1');
|
||||||
var elt2 = document.querySelector('#elt2');
|
var elt2 = document.querySelector('#elt2');
|
||||||
var elt3 = document.querySelector('#elt3');
|
var elt3 = document.querySelector('#elt3');
|
||||||
var elt4 = document.querySelector('#elt4');
|
var elt7 = document.querySelector('#elt7');
|
||||||
|
|
||||||
test('getContentChildNodes (empty)', function() {
|
test('getContentChildNodes (empty)', function() {
|
||||||
var nodes = elt1.getContentChildNodes();
|
var nodes = elt1.getContentChildNodes();
|
||||||
|
Loading…
Reference in New Issue
Block a user