Skip to content

Commit 7fe5e2b

Browse files
committed
Disable chunked dom-repeat tests on IE due to CI rAF flakiness.
1 parent 230ce10 commit 7fe5e2b

1 file changed

Lines changed: 170 additions & 173 deletions

File tree

‎test/unit/dom-repeat.html‎

Lines changed: 170 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -3646,207 +3646,204 @@ <h4>x-repeat-chunked</h4>
36463646

36473647
});
36483648

3649-
suite('chunked rendering', function() {
3649+
// TODO(kschaaf): This test suite has proven to be flaky only on IE, only
3650+
// on CI (Sauce) presumably because of rAF handling in the CI environment
3651+
// disabling for IE for now to avoid Polymer tests being flaky
3652+
if (!/Trident/.test(navigator.userAgent)) {
36503653

3651-
// Patch requestAnimationFrame to setTimeout to reduce IE test flakiness on CI
3652-
var rAF;
3653-
suiteSetup(function() {
3654-
rAF = window.requestAnimationFrame;
3655-
window.requestAnimationFrame = setTimeout;
3656-
});
3657-
suiteTeardown(function() {
3658-
window.requestAnimationFrame = rAF;
3659-
});
3654+
suite('chunked rendering', function() {
36603655

3661-
test('basic chunked rendering', function(done) {
3656+
test('basic chunked rendering', function(done) {
36623657

3663-
var checkItemOrder = function(stamped) {
3664-
for (var i=0; i<stamped.length; i++) {
3665-
assert.equal(stamped[i].textContent, i);
3666-
}
3667-
};
3658+
var checkItemOrder = function(stamped) {
3659+
for (var i=0; i<stamped.length; i++) {
3660+
assert.equal(stamped[i].textContent, i);
3661+
}
3662+
};
36683663

3669-
var lastLength = 0;
3670-
var checkCount = function() {
3671-
var stamped = Polymer.dom(chunked.root).querySelectorAll('*:not(template)');
3672-
checkItemOrder(stamped);
3673-
if (stamped.length && lastLength === 0) {
3674-
// Initial rendering of initial count
3675-
assert.equal(stamped.length, 10);
3676-
} else {
3677-
// Remaining rendering incremenets
3678-
assert.isTrue(stamped.length > lastLength);
3679-
}
3680-
if (stamped.length < 100) {
3681-
lastLength = stamped.length;
3682-
checkUntilComplete();
3683-
} else {
3684-
// Final rendering at exact item count
3685-
assert.equal(stamped.length, 100);
3686-
done();
3687-
}
3688-
};
3689-
var checkUntilComplete = function() {
3690-
// On polyfilled MO, need to wait one setTimeout before rAF
3691-
if (MutationObserver._isPolyfilled) {
3692-
setTimeout(function() {
3664+
var lastLength = 0;
3665+
var checkCount = function() {
3666+
var stamped = Polymer.dom(chunked.root).querySelectorAll('*:not(template)');
3667+
checkItemOrder(stamped);
3668+
if (stamped.length && lastLength === 0) {
3669+
// Initial rendering of initial count
3670+
assert.equal(stamped.length, 10);
3671+
} else {
3672+
// Remaining rendering incremenets
3673+
assert.isTrue(stamped.length > lastLength);
3674+
}
3675+
if (stamped.length < 100) {
3676+
lastLength = stamped.length;
3677+
checkUntilComplete();
3678+
} else {
3679+
// Final rendering at exact item count
3680+
assert.equal(stamped.length, 100);
3681+
done();
3682+
}
3683+
};
3684+
var checkUntilComplete = function() {
3685+
// On polyfilled MO, need to wait one setTimeout before rAF
3686+
if (MutationObserver._isPolyfilled) {
3687+
setTimeout(function() {
3688+
requestAnimationFrame(checkCount);
3689+
});
3690+
} else {
36933691
requestAnimationFrame(checkCount);
3694-
});
3695-
} else {
3696-
requestAnimationFrame(checkCount);
3697-
}
3698-
};
3692+
}
3693+
};
36993694

3700-
chunked.items = chunked.preppedItems.slice();
3701-
checkUntilComplete();
3695+
chunked.items = chunked.preppedItems.slice();
3696+
checkUntilComplete();
37023697

3703-
});
3698+
});
37043699

3705-
test('mutations during chunked rendering', function(done) {
3700+
test('mutations during chunked rendering', function(done) {
37063701

3707-
var checkItemOrder = function(stamped) {
3708-
var last = -1;
3709-
for (var i=0; i<stamped.length; i++) {
3710-
var curr = parseFloat(stamped[i].textContent);
3711-
assert.isTrue(curr > last);
3712-
last = curr;
3713-
}
3714-
};
3702+
var checkItemOrder = function(stamped) {
3703+
var last = -1;
3704+
for (var i=0; i<stamped.length; i++) {
3705+
var curr = parseFloat(stamped[i].textContent);
3706+
assert.isTrue(curr > last);
3707+
last = curr;
3708+
}
3709+
};
37153710

3716-
var mutateArray = function(repeater, renderedCount) {
3717-
// The goal here is to remove & add some, and do it over
3718-
// the threshold of where we have currently rendered items, and
3719-
// ensure that the prop values of the newly inserted items are in
3720-
// ascending order so we can do a simple check in checkItemOrder
3721-
var overlap = 2;
3722-
var remove = 4;
3723-
var add = 6;
3724-
var start = renderedCount.length - overlap;
3725-
if (start + add < repeater.items.length) {
3726-
var end = start + remove;
3727-
var args = ['items', start, remove];
3728-
var startVal = repeater.items[start].prop;
3729-
var endVal = repeater.items[end].prop;
3730-
var delta = (endVal - startVal) / add;
3731-
for (var i=0; i<add; i++) {
3732-
args.push({prop: startVal + i*delta});
3711+
var mutateArray = function(repeater, renderedCount) {
3712+
// The goal here is to remove & add some, and do it over
3713+
// the threshold of where we have currently rendered items, and
3714+
// ensure that the prop values of the newly inserted items are in
3715+
// ascending order so we can do a simple check in checkItemOrder
3716+
var overlap = 2;
3717+
var remove = 4;
3718+
var add = 6;
3719+
var start = renderedCount.length - overlap;
3720+
if (start + add < repeater.items.length) {
3721+
var end = start + remove;
3722+
var args = ['items', start, remove];
3723+
var startVal = repeater.items[start].prop;
3724+
var endVal = repeater.items[end].prop;
3725+
var delta = (endVal - startVal) / add;
3726+
for (var i=0; i<add; i++) {
3727+
args.push({prop: startVal + i*delta});
3728+
}
3729+
repeater.splice.apply(repeater, args);
37333730
}
3734-
repeater.splice.apply(repeater, args);
3735-
}
3736-
};
3731+
};
37373732

3738-
var lastLength = 0;
3739-
var mutateCount = 5;
3740-
var checkCount = function() {
3741-
var stamped = Polymer.dom(chunked.root).querySelectorAll('*:not(template)');
3742-
checkItemOrder(stamped);
3743-
if (stamped.length && lastLength === 0) {
3744-
// Initial rendering of initial count
3745-
assert.equal(stamped.length, 10);
3746-
} else {
3747-
// Remaining rendering incremenets
3748-
assert.isTrue(stamped.length > lastLength);
3749-
}
3750-
if (stamped.length < chunked.items.length) {
3751-
if (mutateCount-- > 0) {
3752-
mutateArray(chunked, stamped);
3733+
var lastLength = 0;
3734+
var mutateCount = 5;
3735+
var checkCount = function() {
3736+
var stamped = Polymer.dom(chunked.root).querySelectorAll('*:not(template)');
3737+
checkItemOrder(stamped);
3738+
if (stamped.length && lastLength === 0) {
3739+
// Initial rendering of initial count
3740+
assert.equal(stamped.length, 10);
3741+
} else {
3742+
// Remaining rendering incremenets
3743+
assert.isTrue(stamped.length > lastLength);
37533744
}
3754-
lastLength = stamped.length;
3755-
checkUntilComplete();
3756-
} else {
3757-
// Final rendering at exact item count
3758-
assert.equal(stamped.length, chunked.items.length);
3759-
done();
3760-
}
3761-
};
3762-
var checkUntilComplete = function() {
3763-
// On polyfilled MO, need to wait one setTimeout before rAF
3764-
if (MutationObserver._isPolyfilled) {
3765-
setTimeout(function() {
3745+
if (stamped.length < chunked.items.length) {
3746+
if (mutateCount-- > 0) {
3747+
mutateArray(chunked, stamped);
3748+
}
3749+
lastLength = stamped.length;
3750+
checkUntilComplete();
3751+
} else {
3752+
// Final rendering at exact item count
3753+
assert.equal(stamped.length, chunked.items.length);
3754+
done();
3755+
}
3756+
};
3757+
var checkUntilComplete = function() {
3758+
// On polyfilled MO, need to wait one setTimeout before rAF
3759+
if (MutationObserver._isPolyfilled) {
3760+
setTimeout(function() {
3761+
requestAnimationFrame(checkCount);
3762+
});
3763+
} else {
37663764
requestAnimationFrame(checkCount);
3767-
});
3768-
} else {
3769-
requestAnimationFrame(checkCount);
3770-
}
3771-
};
3765+
}
3766+
};
37723767

3773-
chunked.items = chunked.preppedItems.slice();
3774-
checkUntilComplete();
3768+
chunked.items = chunked.preppedItems.slice();
3769+
checkUntilComplete();
37753770

3776-
});
3771+
});
37773772

37783773

3779-
test('mutations during chunked rendering, sort & filtered', function(done) {
3774+
test('mutations during chunked rendering, sort & filtered', function(done) {
37803775

3781-
var checkItemOrder = function(stamped) {
3782-
var last = Infinity;
3783-
for (var i=0; i<stamped.length; i++) {
3784-
var curr = parseFloat(stamped[i].textContent);
3785-
assert.isTrue(curr <= last);
3786-
assert.strictEqual(curr % 2, 0);
3787-
last = curr;
3788-
}
3789-
};
3776+
var checkItemOrder = function(stamped) {
3777+
var last = Infinity;
3778+
for (var i=0; i<stamped.length; i++) {
3779+
var curr = parseFloat(stamped[i].textContent);
3780+
assert.isTrue(curr <= last);
3781+
assert.strictEqual(curr % 2, 0);
3782+
last = curr;
3783+
}
3784+
};
37903785

3791-
var mutateArray = function(repeater, stamped) {
3792-
var start = parseInt(stamped[0].textContent);
3793-
var end = parseInt(stamped[stamped.length-1].textContent);
3794-
var mid = (end-start)/2;
3795-
for (var i=0; i<5; i++) {
3796-
chunked.push('items', {prop: mid + 1});
3797-
}
3798-
chunked.splice('items', Math.round(stamped.length/2), 3);
3799-
};
3786+
var mutateArray = function(repeater, stamped) {
3787+
var start = parseInt(stamped[0].textContent);
3788+
var end = parseInt(stamped[stamped.length-1].textContent);
3789+
var mid = (end-start)/2;
3790+
for (var i=0; i<5; i++) {
3791+
chunked.push('items', {prop: mid + 1});
3792+
}
3793+
chunked.splice('items', Math.round(stamped.length/2), 3);
3794+
};
38003795

3801-
var lastLength = 0;
3802-
var mutateCount = 5;
3803-
var checkCount = function() {
3804-
var stamped = Polymer.dom(chunked.root).querySelectorAll('*:not(template)');
3805-
checkItemOrder(stamped);
3806-
var filteredLength = chunked.items.filter(chunked.$.repeater.filter).length;
3807-
if (stamped.length && lastLength === 0) {
3808-
// Initial rendering of initial count
3809-
assert.equal(stamped.length, 10);
3810-
} else {
3811-
// Remaining rendering incremenets
3812-
if (stamped.length < filteredLength) {
3813-
assert.isTrue(stamped.length > lastLength);
3796+
var lastLength = 0;
3797+
var mutateCount = 5;
3798+
var checkCount = function() {
3799+
var stamped = Polymer.dom(chunked.root).querySelectorAll('*:not(template)');
3800+
checkItemOrder(stamped);
3801+
var filteredLength = chunked.items.filter(chunked.$.repeater.filter).length;
3802+
if (stamped.length && lastLength === 0) {
3803+
// Initial rendering of initial count
3804+
assert.equal(stamped.length, 10);
3805+
} else {
3806+
// Remaining rendering incremenets
3807+
if (stamped.length < filteredLength) {
3808+
assert.isTrue(stamped.length > lastLength);
3809+
}
38143810
}
3815-
}
3816-
if (stamped.length < filteredLength) {
3817-
if (mutateCount-- > 0) {
3818-
mutateArray(chunked, stamped);
3811+
if (stamped.length < filteredLength) {
3812+
if (mutateCount-- > 0) {
3813+
mutateArray(chunked, stamped);
3814+
}
3815+
lastLength = stamped.length;
3816+
checkUntilComplete();
3817+
} else {
3818+
assert.equal(stamped.length, filteredLength);
3819+
done();
38193820
}
3820-
lastLength = stamped.length;
3821-
checkUntilComplete();
3822-
} else {
3823-
assert.equal(stamped.length, filteredLength);
3824-
done();
3825-
}
3826-
};
3827-
var checkUntilComplete = function() {
3828-
// On polyfilled MO, need to wait one setTimeout before rAF
3829-
if (MutationObserver._isPolyfilled) {
3830-
setTimeout(function() {
3821+
};
3822+
var checkUntilComplete = function() {
3823+
// On polyfilled MO, need to wait one setTimeout before rAF
3824+
if (MutationObserver._isPolyfilled) {
3825+
setTimeout(function() {
3826+
requestAnimationFrame(checkCount);
3827+
});
3828+
} else {
38313829
requestAnimationFrame(checkCount);
3832-
});
3833-
} else {
3834-
requestAnimationFrame(checkCount);
3835-
}
3836-
};
3830+
}
3831+
};
38373832

3838-
chunked.$.repeater.sort = function(a, b) {
3839-
return b.prop - a.prop;
3840-
};
3841-
chunked.$.repeater.filter = function(a) {
3842-
return (a.prop % 2) === 0;
3843-
};
3844-
chunked.items = chunked.preppedItems.slice();
3845-
checkUntilComplete();
3833+
chunked.$.repeater.sort = function(a, b) {
3834+
return b.prop - a.prop;
3835+
};
3836+
chunked.$.repeater.filter = function(a) {
3837+
return (a.prop % 2) === 0;
3838+
};
3839+
chunked.items = chunked.preppedItems.slice();
3840+
checkUntilComplete();
3841+
3842+
});
38463843

38473844
});
38483845

3849-
});
3846+
}
38503847

38513848
</script>
38523849

0 commit comments

Comments
 (0)