Merge pull request #3414 from Polymer/lint-tests

Lint the tests
This commit is contained in:
Kevin Schaaf 2016-02-12 17:05:15 -08:00
commit d4b53b32a6
35 changed files with 479 additions and 456 deletions

View File

@ -1,5 +1,4 @@
node_modules/*
bower_components/*
test/*
src/**/demo/*
src/**/experimental/*

View File

@ -127,7 +127,7 @@ gulp.task('release', function(cb) {
});
gulp.task('lint', function() {
return gulp.src('src/**/*.html')
return gulp.src(['src/**/*.html', 'test/unit/*.html'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());

3
test/.eslintignore Normal file
View File

@ -0,0 +1,3 @@
assets/*
compat/*
smoke/*

10
test/.eslintrc.json Normal file
View File

@ -0,0 +1,10 @@
{
"env": {
"mocha": true
},
"globals": {
"assert": true,
"sinon": true,
"WCT": true
}
}

View File

@ -32,10 +32,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
<script>
/* global bind observer singleBound multiBound */
suite('basic', function() {
test('single selection', function() {
var el = singleConfigured;
var el = document.querySelector('#singleConfigured');
// Nothing selected
assert.strictEqual(el.selectedItem, null);
assert.isFalse(el.isSelected(el.items[0]));
@ -76,7 +76,7 @@ suite('basic', function() {
});
test('multiple selection', function() {
var el = multiConfigured;
var el = document.querySelector('#multiConfigured');
// Nothing selected
assert.sameMembers(el.selected, []);
assert.isFalse(el.isSelected(el.items[0]));
@ -143,7 +143,7 @@ suite('basic', function() {
};
singleBound.select(bind.items[2]);
assert.equal(called, true);
observer.singleChanged = function(info) {};
observer.singleChanged = function() {};
});
test('single selection sub-property change', function() {
@ -156,7 +156,7 @@ suite('basic', function() {
};
bind.set(['items', 2, 'name'], 'test');
assert.equal(called, true);
observer.singleChanged = function(info) {};
observer.singleChanged = function() {};
});
test('single selection sub-property change after unshift', function() {
@ -170,7 +170,7 @@ suite('basic', function() {
bind.unshift('items', {name: 'zero'});
bind.set(['items', 3, 'name'], 'test2');
assert.equal(called, true);
observer.singleChanged = function(info) {};
observer.singleChanged = function() {};
});
test('multi selection notification', function() {
@ -210,7 +210,7 @@ suite('basic', function() {
};
multiBound.select(bind.items[0]);
assert.equal(called, true);
observer.multiChanged = function(info) {};
observer.multiChanged = function() {};
});
test('multi selection sub-property change', function() {
@ -230,7 +230,7 @@ suite('basic', function() {
};
bind.set(['items', 0, 'name'], 'test2');
assert.equal(called, true);
observer.multiChanged = function(info) {};
observer.multiChanged = function() {};
});

View File

@ -19,7 +19,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<body>
<script>
/* global Async */
setup(function() {
window.Async = Polymer.Async;
});
@ -191,7 +191,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
called3++;
};
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);
Async.cancel(h1);
Async.cancel(h3);
@ -306,7 +306,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
called3++;
};
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);
Async.cancel(h1);
Async.cancel(h3);

View File

@ -65,11 +65,11 @@
propChangedCount: 0,
attr1ChangedCount: 0,
propChanged: function(prop) {
propChanged: function() {
this.propChangedCount++;
},
attr1Changed: function(prop) {
attr1Changed: function() {
this.attr1ChangedCount++;
}

View File

@ -55,6 +55,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</x-reflect>
<script>
/* global basicDefault basicConfigured compose reflectDefault reflectConfigured */
var configuredObject = {foo: 'bar', nested: {'meaning': 42}, arr: [0, 'foo', true]};
var configuredArray = [0, 'foo', true, {foo: 'bar'}];

View File

@ -29,6 +29,7 @@ var instance;
setup(function() {
// Ensure a clean environment for each test.
/* global Base */
window.Base = Polymer.Base;
window.Child = Object.create(Base);
Child._registerFeatures = function() {};

View File

@ -90,7 +90,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
overridablePropertyB: {
value: true
},
}
},
@ -102,7 +102,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
_simpleProperty: 'B',
_disabledChanged: function(disabled) {
this.__disabled = disabled
this.__disabled = disabled;
},
ready: function() {

View File

@ -132,7 +132,7 @@ suite('single-element binding effects', function() {
test('NaN does not loop observers', function() {
el.clearObserverCounts();
el.addEventListener('notifierwithoutcomputing-changed', function(e) {
el.addEventListener('notifierwithoutcomputing-changed', function() {
if (el.observerCounts.notifierWithoutComputingChanged >= 3) {
throw new Error('infinite loop!');
}
@ -155,7 +155,7 @@ suite('single-element binding effects', function() {
test('computed property with multiple dependencies', function() {
var notified = 0;
el.addEventListener('computed-from-multiple-values-changed', function(e) {
el.addEventListener('computed-from-multiple-values-changed', function() {
notified++;
});
el.sum1 = 10;
@ -195,7 +195,7 @@ suite('single-element binding effects', function() {
test('no read-only notification sent with assignment', function() {
var notified = 0;
el.addEventListener('readonlyvalue-changed', function(e) {
el.addEventListener('readonlyvalue-changed', function() {
notified++;
});
el.readonlyvalue = 47;
@ -663,7 +663,7 @@ suite('avoid non-bubbling event gotchas', function() {
suite('warnings', function() {
var el;
var warn;
var warn; //eslint-disable-line no-unused-vars
setup(function() {
el = document.createElement('x-basic');

View File

@ -172,7 +172,7 @@
value: 5
},
attrValue: {
value: 'attrValue',
value: 'attrValue'
},
attrNumber: {
value: '42'

View File

@ -105,6 +105,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
suite('css-parse', function() {
var css, s, tree;
setup(function() {
css = Polymer.CssParse;

View File

@ -21,6 +21,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<input id="input" is="x-input">
<script>
/* global input */
suite('custom-style late property definition', function() {

View File

@ -21,6 +21,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
<script>
/* global earlyDomBind earlyBoundChild decEl1 decEl2 decDomBind z container needsHost*/
earlyDomBind.value = 'hi!';
</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');
document.body.removeChild(el);
done();
})
});
});
test('dom-bind distributed when inserted in element attached (flush)', function() {

View File

@ -111,7 +111,7 @@
value: true
},
prop: {
value: 'outer',
value: 'outer'
},
item: {
value: function() { return {prop: 'outerItem'}; }
@ -141,13 +141,13 @@
is: 'x-nested-if-individual',
properties: {
prop1: {
value: 'prop1',
value: 'prop1'
},
prop2: {
value: 'prop2',
value: 'prop2'
},
prop3: {
value: 'prop3',
value: 'prop3'
},
item: {
value: function() { return {prop: 'outerItem'}; }

View File

@ -72,7 +72,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</div>
<script>
/* global configured individual unconfigured1 unconfigured2 inDocumentContainer inDocumentIf structuredContainer structuredDomIf structuredDomBind outerContainer innerContainer shouldBeRemoved toBeRemoved removalContainer*/
suite('nested pre-configured dom-if', function() {
test('parent scope binding', function() {

View File

@ -12,7 +12,7 @@
</template>
</dom-module>
<script>
TestElement = Polymer({
window.TestElement = Polymer({
is: 'Test-element'
});
</script>

View File

@ -52,9 +52,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
test('mixed case element creation', function() {
t = new TestElement();
var t = new TestElement(); //eslint-disable-line
assert.ok(t.$.content);
})
});
});

View File

@ -26,7 +26,7 @@ window.data = [
{ prop: 'prop-1-3-2' },
{ prop: 'prop-1-3-3' }
]
},
}
]
},
{
@ -55,7 +55,7 @@ window.data = [
{ prop: 'prop-2-3-2' },
{ prop: 'prop-2-3-3' }
]
},
}
]
},
{
@ -84,7 +84,7 @@ window.data = [
{ prop: 'prop-3-3-2' },
{ prop: 'prop-3-3-3' }
]
},
}
]
}
];
@ -129,19 +129,19 @@ window.data = [
notify: true
},
inneraProp: {
notify: true,
notify: true
},
itemaProp: {
notify: true
},
innerbProp: {
notify: true,
notify: true
},
itembProp: {
notify: true
},
innercProp: {
notify: true,
notify: true
},
itemcProp: {
notify: true
@ -167,19 +167,19 @@ window.data = [
notify: true
},
inneraProp: {
notify: true,
notify: true
},
itemaProp: {
notify: true
},
innerbProp: {
notify: true,
notify: true
},
itembProp: {
notify: true
},
innercProp: {
notify: true,
notify: true
},
itemcProp: {
notify: true
@ -310,7 +310,7 @@ window.data = [
value: window.data
},
prop: {
value: 'outer',
value: 'outer'
},
item: {
value: function() { return {prop: 'outerItem'}; }
@ -467,7 +467,7 @@ window.data = [
created: function() {
var time = performance.now();
time += 4;
while (performance.now() < time) {}
while (performance.now() < time) {} //eslint-disable-line no-empty
}
});
</script>

View File

@ -81,6 +81,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</div>
<script>
/* global unconfigured1 unconfigured primitive limited inDocumentRepeater configured inDocumentContainer inDocumentContainerOrig unconfigured2 primitiveLarge simple:true model:true stamped:true chunked */
/*
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() {
var warned = false;
inDocumentRepeater._error = function(message) {
assert.match(message, /expected array/)
assert.match(message, /expected array/);
warned = true;
}
};
inDocumentRepeater.items = {};
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() {
var stamped = Polymer.dom(unconfigured1.root).querySelectorAll('*:not(template)');
unconfigured1.prop = 'outer';
unconfigured1.item = {prop: 'outerItem'}
unconfigured1.item = {prop: 'outerItem'};
assert.equal(stamped[0].outerProp, 'outer');
assert.equal(stamped[0].outerItemProp, 'outerItem');
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');
repeater1.filter = function(item) {
return (item != 'a' && item != 'e');
}
};
repeater1.render();
assert.equal(repeater1.renderedItemCount, 3, 'renderedItemCount incorrect after filter');
// reset repeater

View File

@ -73,7 +73,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
down: 'handler',
up: 'handler'
},
handler: function(e, detail) {
handler: function() {
}
});
</script>

View File

@ -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.track, 1, 'mousedown track');
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.tap, 1, 'touchstart tap');
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._count, 1, 'total touchmove');
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.track, 1, 'mousedown track');
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.tap, 1, 'touchstart tap');
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._count, 1, 'total touchmove');
assert.equal(obj.touchend.downup, 2, 'touchend downup');
assert.equal(obj.touchend.track, 1, 'touchend track');
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() {
@ -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._count, 0, 'total touchstart');
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.touchend.downup, 0, 'touchend downup');
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._count, 0, 'total touchstart');
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.touchend.downup, 0, 'touchend downup');
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() {
var actual = Polymer.Gestures.deepTargetFind(-1, -1);
assert.equal(actual, null);
})
});
test('find the div in document', function() {
var x = divLocation.left, y = divLocation.top;

View File

@ -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="../../../webcomponentsjs/webcomponents-lite.js"></script>
<script>
/* global origOwnProps:true */
window.origOwnProps = Object.getOwnPropertyNames(window).reduce(function(props, prop) {
return props[prop] = true && props;
}, {});

View File

@ -27,7 +27,7 @@
},
observers: [
'objSubpathChanged(obj.*)',
'objValueChanged(obj.value)',
'objValueChanged(obj.value)'
],
created: function() {
this.observerCounts = {
@ -51,7 +51,7 @@
objValueChanged: function(value) {
this.observerCounts.objValueChanged++;
assert.equal(this.obj.value, value);
},
}
});
</script>
</dom-module>
@ -71,7 +71,7 @@
},
observers: [
'objSubpathChanged(obj.*)',
'objValueChanged(obj.value)',
'objValueChanged(obj.value)'
],
created: function() {
this.observerCounts = {
@ -96,7 +96,7 @@
objValueChanged: function(value) {
this.observerCounts.objValueChanged++;
assert.equal(this.obj.value, value);
},
}
});
</script>
</dom-module>
@ -211,7 +211,7 @@
'arrayChanged keySplices incorrect');
}
},
arrayChangedDeep: function(info) { },
arrayChangedDeep: function() { },
arrayNoCollChanged: function(splices) {
this.observerCounts.arrayNoCollChanged++;
if (this.arrayNoColl.length) {
@ -221,7 +221,7 @@
'arrayNoCollChanged indexSplices incorrect');
}
},
arrayOrPropChanged: function(prop, splices) {
arrayOrPropChanged: function(prop) {
this.observerCounts.arrayOrPropChanged++;
assert.equal(prop, this.prop);
},

View File

@ -813,7 +813,7 @@ suite('path API', function() {
el.arrayChanged = nop;
el.array = ['orig1', 'orig2', 'orig3'];
Polymer.Collection.get(el.array);
el.arrayChanged = function(change) {
el.arrayChanged = function() {
throw new Error("should not notify");
};
var ret = el.push('array');
@ -828,7 +828,7 @@ suite('path API', function() {
el.arrayChanged = nop;
el.array = [];
Polymer.Collection.get(el.array);
el.arrayChanged = function(change) {
el.arrayChanged = function() {
throw new Error("should not notify");
};
var ret = el.pop('array');
@ -840,8 +840,7 @@ suite('path API', function() {
el.arrayChanged = nop;
el.array = ['orig1', 'orig2', 'orig3'];
Polymer.Collection.get(el.array);
var key = el.array.length;
el.arrayChanged = function(change) {
el.arrayChanged = function() {
throw new Error("should not notify");
};
var ret = el.unshift('array');
@ -856,7 +855,7 @@ suite('path API', function() {
el.arrayChanged = nop;
el.array = [];
Polymer.Collection.get(el.array);
el.arrayChanged = function(change) {
el.arrayChanged = function() {
throw new Error("should not notify");
};
var ret = el.shift('array');
@ -868,9 +867,8 @@ suite('path API', function() {
test('corner: no-op splice array', function() {
el.arrayChanged = nop;
el.array = ['orig1', 'orig2', 'orig3'];
var key = el.array.length;
Polymer.Collection.get(el.array);
el.arrayChanged = function(change) {
el.arrayChanged = function() {
throw new Error("should not notify");
};
var ret = el.splice('array');

View File

@ -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
// ensures Polymer.dom functions correctly under Shadow DOM.
usingShady = !Polymer.Settings.useNativeShadow;
})
});
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 s2 = document.createElement('span');
var s3 = document.createElement('span');
var composedChildren;
frag.appendChild(s1);
frag.appendChild(s2);
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[2], s3);
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[0], s1);
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();
if (host.shadyRoot) {
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[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 s2 = document.createElement('span');
var s3 = document.createElement('span');
var composedChildren;
frag.appendChild(s1);
frag.appendChild(s2);
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[2], s3);
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[0], s1);
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();
if (host.shadyRoot) {
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[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() {
var h1 = document.createElement('x-dist');
var h2 = document.createDocumentFragment();;
var h2 = document.createDocumentFragment();
document.body.appendChild(h1);
Polymer.dom.flush();
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');
div.innerHTML = '<x-dist><div></div></x-dist>';
var h1 = div.firstChild;
var h2 = document.createDocumentFragment();;
var h2 = document.createDocumentFragment();
document.body.appendChild(h1);
Polymer.dom.flush();
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() {
var h1 = document.createElement('x-dist-inside-deep-tree');
var h2 = document.createDocumentFragment();;
var h2 = document.createDocumentFragment();
document.body.appendChild(h1);
Polymer.dom.flush();
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');
div.innerHTML = '<x-dist-inside-deep-tree><div></div></x-dist-inside-deep-tree>';
var h1 = div.firstChild;
var h2 = document.createDocumentFragment();;
var h2 = document.createDocumentFragment();
document.body.appendChild(h1);
Polymer.dom.flush();
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() {
var h1 = document.createElement('x-dist-simple');
var h2 = document.createDocumentFragment();;
var h2 = document.createDocumentFragment();
document.body.appendChild(h1);
Polymer.dom.flush();
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;
Polymer.dom.flush();
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.equal(Polymer.dom(ip).getDistributedNodes()[0], c1);
if (el.shadyRoot) {

View File

@ -256,7 +256,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var recordedInfo, elAddedInObserver;
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) {
elAddedInObserver = document.createElement('div');
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(d1);
setTimeout(function() {
assert.notEqual(nodes.length, el.getEffectiveChildNodes().length)
assert.notEqual(nodes.length, el.getEffectiveChildNodes().length);
document.body.removeChild(el);
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');
document.body.appendChild(el);
var recorded;
var handle = Polymer.dom(el.$.content).observeNodes(function(info) {
Polymer.dom(el.$.content).observeNodes(function(info) {
recorded = info;
});
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');
document.body.appendChild(el);
var recorded;
var handle = Polymer.dom(el).observeNodes(function(info) {
Polymer.dom(el).observeNodes(function(info) {
recorded = info;
});
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');
document.body.appendChild(el);
var r1 = 0;
var h1 = Polymer.dom(el.$.content).observeNodes(function(info) {
var h1 = Polymer.dom(el.$.content).observeNodes(function() {
r1++;
});
var r2 = 0;
var h2 = Polymer.dom(el.$.content).observeNodes(function(info) {
var h2 = Polymer.dom(el.$.content).observeNodes(function() {
r2++;
});
var r3 = 0;
var h3 = Polymer.dom(el.$.content).observeNodes(function(info) {
var h3 = Polymer.dom(el.$.content).observeNodes(function() {
r3++;
});
// 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(r3, 1);
Polymer.dom(el.$.content).unobserveNodes(h1);
var d = document.createElement('div');
d = document.createElement('div');
Polymer.dom(el).appendChild(d);
Polymer.dom.flush();
assert.equal(r1, 1);
assert.equal(r2, 2);
assert.equal(r3, 2);
Polymer.dom(el.$.content).unobserveNodes(h2);
var d = document.createElement('div');
d = document.createElement('div');
Polymer.dom(el).appendChild(d);
Polymer.dom.flush();
assert.equal(r1, 1);
assert.equal(r2, 2);
assert.equal(r3, 3);
Polymer.dom(el.$.content).unobserveNodes(h3);
var d = document.createElement('div');
d = document.createElement('div');
Polymer.dom(el).appendChild(d);
Polymer.dom.flush();
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(r2, 3);
assert.equal(r3, 4);
var d = document.createElement('div');
d = document.createElement('div');
Polymer.dom(el).appendChild(d);
Polymer.dom.flush();
assert.equal(r1, 3);
assert.equal(r2, 4);
assert.equal(r3, 5);
Polymer.dom(el.$.content).unobserveNodes(h3);
var d = document.createElement('div');
d = document.createElement('div');
Polymer.dom(el).appendChild(d);
Polymer.dom.flush();
assert.equal(r1, 4);
assert.equal(r2, 5);
assert.equal(r3, 5);
Polymer.dom(el.$.content).unobserveNodes(h2);
var d = document.createElement('div');
d = document.createElement('div');
Polymer.dom(el).appendChild(d);
Polymer.dom.flush();
assert.equal(r1, 5);
assert.equal(r2, 5);
assert.equal(r3, 5);
Polymer.dom(el.$.content).unobserveNodes(h1);
var d = document.createElement('div');
d = document.createElement('div');
Polymer.dom(el).appendChild(d);
Polymer.dom.flush();
assert.equal(r1, 5);

View File

@ -1,19 +1,21 @@
<script>
/* global chai */
var assert = chai.assert;
var configureList = [];
var readyList = [];
function clearTestLists() {
function clearTestLists() { //eslint-disable-line
configureList = [];
readyList = [];
}
var readyBehavior = {
moniker: function() {
return this.is + (this.id ? '#' + this.id : '')
return this.is + (this.id ? '#' + this.id : '');
},
// use private, stateful, method for testing purposes
_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());
},
ready: function() {
@ -21,7 +23,7 @@
},
attached: function() {
chai.assert.isTrue(this._readied, 'Element not ready when attached');
assert.isTrue(this._readied, 'Element not ready when attached');
}
};
</script>

View File

@ -1,4 +1,5 @@
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 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'];

View File

@ -123,7 +123,7 @@ test('Reproject', function() {
'a: <content select=a></content>b: <content select=b></content>');
var textNodeA = p.shadyRoot.firstChild;
var contentA = p.shadyRoot.childNodes[1];
var textNodeB = p.shadyRoot.childNodes[2]
var textNodeB = p.shadyRoot.childNodes[2];
var contentB = p.shadyRoot.childNodes[3];
function testRender() {
@ -360,7 +360,6 @@ suite('Mutate light DOM', function() {
test('replaceChild - mutate host', function() {
var host = document.createElement('x-content-test');
setInnerHTML(host, '<a>Hello</a>');
var a = host.firstChild;
syncLightDOM(host);
setRootInnerHTML(host.shadyRoot, '<content></content>');
@ -460,7 +459,7 @@ function setInnerHTML(node, value) {
var temp = node.ownerDocument.createElement('div');
temp.innerHTML = value;
var firstChild;
while (firstChild = temp.firstChild) {
while ((firstChild = temp.firstChild)) {
nativeAppendChild.call(node, firstChild);
}
}

View File

@ -35,7 +35,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var proto = Object.create(HTMLElement.prototype);
proto.createdCallback = function() {
this.root = this.createShadowRoot();
}
};
document.registerElement('unknown-host', {prototype: proto});
});
</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');
}
/* eslint-disable no-unused-vars */
function assertStylePropertyValue(properties, name, includeValue) {
assert.property(properties, name);
assert.include(properties[name], includeValue);
}
/* eslint-enable no-unused-vars */
test('element in top level unknown host styled via property defaults', function() {
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>

View File

@ -21,6 +21,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script>
suite('templatizer client and template separate', function() {
/* global childA childB */
var host;

View File

@ -58,7 +58,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var elt1 = document.querySelector('#elt1');
var elt2 = document.querySelector('#elt2');
var elt3 = document.querySelector('#elt3');
var elt4 = document.querySelector('#elt4');
var elt7 = document.querySelector('#elt7');
test('getContentChildNodes (empty)', function() {
var nodes = elt1.getContentChildNodes();