|
33 | 33 | await new Promise(resolve => t.step_timeout(resolve, 0));
|
34 | 34 | await new Promise(requestAnimationFrame);
|
35 | 35 |
|
36 |
| - assert_equals(document.activeElement, button, |
37 |
| - 'Previously focused element should be focused after waiting for a task.'); |
| 36 | + assert_not_equals(document.activeElement, button, |
| 37 | + 'Previously focused element should not be focused, even after waiting for a task.'); |
38 | 38 | assert_false(dialog.matches(':modal'),
|
39 | 39 | 'The dialog should not match :modal after closing.');
|
40 | 40 | assert_false(cancelFired,
|
|
47 | 47 | await test_driver.click(button);
|
48 | 48 | assert_true(buttonFiredClick,
|
49 | 49 | 'The page should not be inert or blocked after removing the open attribute.');
|
| 50 | + // Clean up |
| 51 | + dialog.showModal(); |
| 52 | + dialog.close(); |
50 | 53 | }, 'Removing the open attribute from an open modal dialog should run the closing algorithm.');
|
51 | 54 |
|
52 | 55 | promise_test(async t => {
|
|
66 | 69 | await new Promise(resolve => t.step_timeout(resolve, 0));
|
67 | 70 | await new Promise(requestAnimationFrame);
|
68 | 71 |
|
69 |
| - assert_equals(document.activeElement, button, |
70 |
| - 'Previously focused element should be focused after waiting for a task.'); |
| 72 | + assert_not_equals(document.activeElement, button, |
| 73 | + 'Previously focused element should not be focused, even after waiting for a task.'); |
71 | 74 | assert_false(cancelFired,
|
72 | 75 | 'The cancel event should not fire when removing the open attribute.');
|
73 | 76 | assert_true(closeFired,
|
74 | 77 | 'The close event should be fired when removing the open attribute.');
|
| 78 | + // Clean up |
| 79 | + dialog.show(); |
| 80 | + dialog.close(); |
75 | 81 | }, 'Removing the open attribute from an open non-modal dialog should fire a close event.');
|
76 | 82 | </script>
|
0 commit comments