test fixes

This commit is contained in:
Steven Orvell 2017-02-24 20:59:45 -08:00
parent 29ea17754d
commit e07f9e1d61
2 changed files with 30 additions and 33 deletions

View File

@ -345,7 +345,7 @@ window.data = [
<dom-module id="x-simple-repeat">
<template>
<template is="dom-repeat" items="{{items}}">
<template id="repeat" is="dom-repeat" items="{{items}}">
<x-foo itema-prop="{{item.prop}}"></x-foo>
</template>
</template>

View File

@ -5653,39 +5653,36 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
test('css scoping retained when re-ordering', function(done) {
var removed;
if (!Polymer.Settings.useShadow) {
// Confirm initial scoping
var stamped = simple.root.querySelectorAll('*:not(template):not(dom-repeat)');
assert.equal(stamped[0].itemaProp, 'prop-1');
assert(stamped[0].classList.contains('x-simple-repeat'), 'expected scoping');
assert.equal(stamped.length, 3, 'total stamped count incorrect');
var row = stamped[0];
// Move
removed = simple.splice('items', 0, 1);
simple.splice('items', 1, 0, removed[0]);
setTimeout(function() {
stamped = simple.root.querySelectorAll('*:not(template):not(dom-repeat)');
assert.equal(stamped.length, 3, 'total stamped count incorrect');
assert.equal(row, stamped[1]);
assert.equal(stamped[1].itemaProp, 'prop-1');
assert(stamped[1].classList.contains('x-simple-repeat'), 'expected scoping');
// Revert
removed = simple.splice('items', 1, 1);
simple.splice('items', 0, 0, removed[0]);
setTimeout(function() {
stamped = simple.root.querySelectorAll('*:not(template):not(dom-repeat)');
assert.equal(stamped.length, 3, 'total stamped count incorrect');
assert.equal(row, stamped[0]);
assert.equal(stamped[0].itemaProp, 'prop-1');
assert(stamped[0].classList.contains('x-simple-repeat'), 'expected scoping');
done();
});
});
} else {
done();
test('css scoping retained when re-ordering', function() {
if (!window.ShadyDOM) {
this.skip();
}
var removed;
// Confirm initial scoping
var stamped = simple.root.querySelectorAll('*:not(template):not(dom-repeat)');
assert.equal(stamped[0].itemaProp, 'prop-1');
assert(stamped[0].classList.contains('x-simple-repeat'), 'expected scoping');
assert.equal(stamped.length, 3, 'total stamped count incorrect');
// Move
removed = simple.splice('items', 0, 1);
simple.splice('items', 1, 0, removed[0]);
Polymer.flush();
stamped = simple.root.querySelectorAll('*:not(template):not(dom-repeat)');
assert.equal(stamped.length, 3, 'total stamped count incorrect');
let movedItem = simple.$.repeat.modelForElement(stamped[1]).item;
assert.equal(removed[0], movedItem);
assert.equal(stamped[1].itemaProp, 'prop-1');
assert(stamped[1].classList.contains('x-simple-repeat'), 'expected scoping');
// Revert
removed = simple.splice('items', 1, 1);
simple.splice('items', 0, 0, removed[0]);
Polymer.flush();
stamped = simple.root.querySelectorAll('*:not(template):not(dom-repeat)');
assert.equal(stamped.length, 3, 'total stamped count incorrect');
movedItem = simple.$.repeat.modelForElement(stamped[0]).item;
assert.equal(removed[0], movedItem);
assert.equal(stamped[0].itemaProp, 'prop-1');
assert(stamped[0].classList.contains('x-simple-repeat'), 'expected scoping');
});
});