Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 7f29f53

Browse files
committed
Merge pull request #7979 from adobe/rlim/file-filters-tests
Fix file filters integration tests failures.
2 parents e71e09a + 9e500d8 commit 7f29f53

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

test/spec/FileFilters-test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ define(function (require, exports, module) {
563563

564564
// Edit the filter & confirm changes
565565
$(".modal.instance textarea").val("*.css");
566-
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK);
566+
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK, true);
567567
}
568568

569569
it("should exclude files from search", function () {
@@ -622,7 +622,7 @@ define(function (require, exports, module) {
622622

623623
// Edit the filter & confirm changes
624624
$(".modal.instance textarea").val("test1.*\n*.css");
625-
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK);
625+
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK, true);
626626
});
627627
runs(function () {
628628
executeSearch("{1}");
@@ -753,7 +753,7 @@ define(function (require, exports, module) {
753753
// Edit the filter & confirm changes
754754
$(".modal.instance .exclusions-name").val("CSS Files");
755755
$(".modal.instance .exclusions-editor").val("*.css\n*.less\n*.scss");
756-
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK);
756+
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK, true);
757757
}
758758

759759
// Trigger a mouseover event on the 'parent' and then click on the button with the given 'selector'.
@@ -916,7 +916,7 @@ define(function (require, exports, module) {
916916

917917
$(".modal.instance .exclusions-name").val("");
918918
$(".modal.instance .exclusions-editor").val("*.css");
919-
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK);
919+
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK, true);
920920
});
921921

922922
runs(function () {
@@ -935,17 +935,17 @@ define(function (require, exports, module) {
935935
// Create three filter sets and make the last one active.
936936
runs(function () {
937937
FileFilters.editFilter(filters[0], 0);
938-
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK);
938+
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK, true);
939939
});
940940

941941
runs(function () {
942942
FileFilters.editFilter(filters[1], -1);
943-
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK);
943+
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK, true);
944944
});
945945

946946
runs(function () {
947947
FileFilters.editFilter(filters[2], -1);
948-
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK);
948+
SpecRunnerUtils.clickDialogButton(Dialogs.DIALOG_BTN_OK, true);
949949
});
950950

951951
runs(function () {
@@ -1045,5 +1045,5 @@ define(function (require, exports, module) {
10451045
});
10461046
});
10471047
});
1048-
});
1048+
});
10491049
});

test/spec/SpecRunnerUtils.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,20 +452,26 @@ define(function (require, exports, module) {
452452
* outcome. Also, in cases where asynchronous tasks are performed after the dialog closes,
453453
* clients must also wait for any additional promises.
454454
* @param {string} buttonId One of the Dialogs.DIALOG_BTN_* symbolic constants.
455+
* @param {boolean=} enableFirst If true, then enable the button before clicking.
455456
*/
456-
function clickDialogButton(buttonId) {
457+
function clickDialogButton(buttonId, enableFirst) {
457458
// Make sure there's one and only one dialog open
458459
var $dlg = _testWindow.$(".modal.instance"),
459460
promise = $dlg.data("promise");
460461

461462
expect($dlg.length).toBe(1);
462463

463464
// Make sure desired button exists
464-
var dismissButton = $dlg.find(".dialog-button[data-button-id='" + buttonId + "']");
465-
expect(dismissButton.length).toBe(1);
465+
var $dismissButton = $dlg.find(".dialog-button[data-button-id='" + buttonId + "']");
466+
expect($dismissButton.length).toBe(1);
467+
468+
if (enableFirst) {
469+
// Remove the disabled prop.
470+
$dismissButton.prop("disabled", false);
471+
}
466472

467473
// Click the button
468-
dismissButton.click();
474+
$dismissButton.click();
469475

470476
// Dialog should resolve/reject the promise
471477
waitsForDone(promise, "dismiss dialog");

0 commit comments

Comments
 (0)