Merge "Fix race condition in gr-reply-dialog_test.html"

This commit is contained in:
Andrew Bonventre 2016-09-16 20:47:03 +00:00 committed by Gerrit Code Review
commit 27ce157cac

View File

@ -382,21 +382,26 @@ limitations under the License.
}); });
test('only send labels that have changed', function(done) { test('only send labels that have changed', function(done) {
var saveReviewStub = sinon.stub(element, '_saveReview', flush(function() {
function(review) { var saveReviewStub = sinon.stub(element, '_saveReview',
assert.deepEqual(review.labels, {Verified: -1}); function(review) {
return Promise.resolve({ok: true}); assert.deepEqual(review.labels, {Verified: -1});
}); return Promise.resolve({ok: true});
});
element.addEventListener('send', function() { element.addEventListener('send', function() {
saveReviewStub.restore(); saveReviewStub.restore();
done(); done();
});
// Without wrapping this test in flush(), the below two calls to
// MockInteractions.tap() cause a race in some situations in shadow DOM.
// The send button can be tapped before the others, causing the test to
// fail.
MockInteractions.tap(element.$$(
'iron-selector[data-label="Verified"] > ' +
'gr-button[data-value="-1"]'));
MockInteractions.tap(element.$$('.send'));
}); });
MockInteractions.tap(element.$$(
'iron-selector[data-label="Verified"] > ' +
'gr-button[data-value="-1"]'));
MockInteractions.tap(element.$$('.send'));
}); });
}); });
</script> </script>