Skip to content

Commit 5cc66fa

Browse files
committed
Improve robustness of titles_test "Editable titles"
The editTitle function could previously select the editNode from a previous call if the blur event didn't remove it from the DOM in time.
1 parent 45d6ce1 commit 5cc66fa

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

test/jasmine/tests/titles_test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,8 +1288,10 @@ describe('Editable titles', function() {
12881288

12891289
var textNode = document.querySelector('.' + className);
12901290
textNode.dispatchEvent(new window.MouseEvent('click'));
1291-
1292-
var editNode = document.querySelector('.plugin-editable.editable');
1291+
// make sure to select the editNode created by the click, not some leftover
1292+
// from the previous call (the blur event removes it asynchronously.)
1293+
var editNodes = document.querySelectorAll('.plugin-editable.editable');
1294+
var editNode = editNodes[editNodes.length - 1];
12931295
editNode.dispatchEvent(new window.FocusEvent('focus'));
12941296
editNode.textContent = text;
12951297
editNode.dispatchEvent(new window.FocusEvent('focus'));

0 commit comments

Comments
 (0)