diff --git a/src/htmlContent/findreplace-bar.html b/src/htmlContent/findreplace-bar.html
index 7273f266f35..8ea2115054b 100644
--- a/src/htmlContent/findreplace-bar.html
+++ b/src/htmlContent/findreplace-bar.html
@@ -1,17 +1,17 @@
{{/replace}}
diff --git a/src/search/FindInFiles.js b/src/search/FindInFiles.js
index 4d2b3df38ef..41eb7c9cf4d 100644
--- a/src/search/FindInFiles.js
+++ b/src/search/FindInFiles.js
@@ -152,10 +152,10 @@ define(function (require, exports, module) {
return null;
}
- var caseSensitive = $("#find-case-sensitive").is(".active");
+ var caseSensitive = $(".find-case-sensitive").is(".active");
// Is it a (non-blank) regex?
- if ($("#find-regexp").is(".active")) {
+ if ($(".find-regexp").is(".active")) {
try {
return new RegExp(query, caseSensitive ? "g" : "gi");
} catch (e) {
@@ -949,7 +949,7 @@ define(function (require, exports, module) {
// Synchronously close Find/Replace bar first, if open (TODO: remove once #6203 fixed)
// (Any previous open FindInFiles bar instance was already handled by our caller)
- FindReplace._closeFindBar();
+ FindReplace._closeFindBar(this.modalBar);
this.modalBar = new ModalBar(dialogHTML, true);
$(this.modalBar).on("close", this._handleClose.bind(this));
@@ -961,7 +961,7 @@ define(function (require, exports, module) {
return self.getDialogTextField().attr("disabled") || $(".modal.instance .exclusions-editor").length > 0;
};
- var $searchField = $("input#find-what"),
+ var $searchField = $("input.find-what"),
candidateFilesPromise = getCandidateFiles(), // used for eventual search, and in exclusions editor UI
filterPicker;
@@ -1004,9 +1004,9 @@ define(function (require, exports, module) {
.bind("input", handleQueryChange)
.focus();
- this.modalBar.getRoot().on("click", "#find-case-sensitive, #find-regexp", function (e) {
+ this.modalBar.getRoot().on("click", ".find-case-sensitive, .find-regexp", function (e) {
$(e.currentTarget).toggleClass('active');
- FindReplace._updatePrefsFromSearchBar();
+ FindReplace._updatePrefsFromSearchBar(self.modalBar);
handleQueryChange(); // re-validate regexp if needed
});
@@ -1023,7 +1023,7 @@ define(function (require, exports, module) {
}
// Initial UI state (including prepopulated initialString passed into template)
- FindReplace._updateSearchBarFromPrefs();
+ FindReplace._updateSearchBarFromPrefs(this.modalBar);
handleQueryChange();
};
diff --git a/src/search/FindReplace.js b/src/search/FindReplace.js
index 710f69288e9..81fa16d2984 100644
--- a/src/search/FindReplace.js
+++ b/src/search/FindReplace.js
@@ -105,27 +105,42 @@ define(function (require, exports, module) {
return cm.getSearchCursor(query, pos, !PreferencesManager.getViewState("caseSensitive"));
}
- function _updateSearchBarFromPrefs() {
- $("#find-case-sensitive").toggleClass("active", PreferencesManager.getViewState("caseSensitive"));
- $("#find-regexp").toggleClass("active", PreferencesManager.getViewState("regexp"));
+ /**
+ * @private
+ * Returns the item in the modal bar matching the given selector, or an empty jQuery object if
+ * there is no modalBar.
+ * @type {string} selector The selector to find elements for
+ */
+ function _getModalBarItem(selector) {
+ if (modalBar) {
+ return $(selector, modalBar.getRoot());
+ } else {
+ // Just return an empty $ object so we don't have to null-check everywhere.
+ return $();
+ }
+ }
+
+ function _updateSearchBarFromPrefs(bar) {
+ $(".find-case-sensitive", bar.getRoot()).toggleClass("active", PreferencesManager.getViewState("caseSensitive"));
+ $(".find-regexp", bar.getRoot()).toggleClass("active", PreferencesManager.getViewState("regexp"));
}
- function _updatePrefsFromSearchBar() {
- PreferencesManager.setViewState("caseSensitive", $("#find-case-sensitive").is(".active"));
- PreferencesManager.setViewState("regexp", $("#find-regexp").is(".active"));
+ function _updatePrefsFromSearchBar(bar) {
+ PreferencesManager.setViewState("caseSensitive", $(".find-case-sensitive", bar.getRoot()).is(".active"));
+ PreferencesManager.setViewState("regexp", $(".find-regexp", bar.getRoot()).is(".active"));
}
function parseQuery(query) {
- $(".modal-bar .message").show();
- $(".modal-bar .error").hide();
+ _getModalBarItem(".message").show();
+ _getModalBarItem(".error").hide();
// Is it a (non-blank) regex?
- if (query && $("#find-regexp").is(".active")) {
+ if (query && _getModalBarItem(".find-regexp").is(".active")) {
try {
- var caseSensitive = $("#find-case-sensitive").is(".active");
+ var caseSensitive = _getModalBarItem(".find-case-sensitive").is(".active");
return new RegExp(query, caseSensitive ? "" : "i");
} catch (e) {
- $(".modal-bar .message").hide();
- $(".modal-bar .error")
+ _getModalBarItem(".message").hide();
+ _getModalBarItem(".error")
.show()
.text(e.message);
return "";
@@ -429,10 +444,10 @@ define(function (require, exports, module) {
});
}
- function _closeFindBar() {
- if (modalBar) {
+ function _closeFindBar(bar) {
+ if (bar) {
// 1st arg = restore scroll pos; 2nd arg = no animation, since getting replaced immediately
- modalBar.close(true, false);
+ bar.close(true, false);
}
}
function _registerFindInFilesCloser(closer) {
@@ -447,7 +462,7 @@ define(function (require, exports, module) {
// the modal bar to close. Rather than reinstate that hack, we simply explicitly
// close the old modal bar (which may be a Find, Replace, *or* Find in Files bar
// before creating a new one. (TODO: remove once #6203 fixed)
- _closeFindBar();
+ _closeFindBar(modalBar);
closeFindInFilesBar();
modalBar = new ModalBar(template, true); // 2nd arg = auto-close on Esc/blur
@@ -488,11 +503,11 @@ define(function (require, exports, module) {
function indicateHasMatches(numResults) {
// Make the field red if it's not blank and it has no matches (which also covers invalid regexes)
- ViewUtils.toggleClass($("#find-what"), "no-results", !state.foundAny && $("#find-what").val());
+ ViewUtils.toggleClass(_getModalBarItem(".find-what"), "no-results", !state.foundAny && _getModalBarItem(".find-what").val());
// Buttons disabled if blank, OR if no matches (Replace buttons) / < 2 matches (nav buttons)
- $("#find-prev, #find-next").prop("disabled", !state.foundAny || numResults < 2);
- $("#replace-yes, #replace-all").prop("disabled", !state.foundAny);
+ _getModalBarItem(".find-prev, .find-next").prop("disabled", !state.foundAny || numResults < 2);
+ _getModalBarItem(".replace-yes, .replace-all").prop("disabled", !state.foundAny);
}
cm.operation(function () {
@@ -503,7 +518,7 @@ define(function (require, exports, module) {
if (!state.query) {
// Search field is empty - no results
- $("#find-counter").text("");
+ _getModalBarItem(".find-counter").text("");
state.foundAny = false;
indicateHasMatches();
return;
@@ -535,18 +550,18 @@ define(function (require, exports, module) {
}
if (resultSet.length === 0) {
- $("#find-counter").text(Strings.FIND_NO_RESULTS);
+ _getModalBarItem(".find-counter").text(Strings.FIND_NO_RESULTS);
} else if (resultSet.length === 1) {
- $("#find-counter").text(Strings.FIND_RESULT_COUNT_SINGLE);
+ _getModalBarItem(".find-counter").text(Strings.FIND_RESULT_COUNT_SINGLE);
} else {
- $("#find-counter").text(StringUtils.format(Strings.FIND_RESULT_COUNT, resultSet.length));
+ _getModalBarItem(".find-counter").text(StringUtils.format(Strings.FIND_RESULT_COUNT, resultSet.length));
}
state.foundAny = (resultSet.length > 0);
indicateHasMatches(resultSet.length);
} else {
// On huge documents, just look for first match & then stop
- $("#find-counter").text("");
+ _getModalBarItem(".find-counter").text("");
state.foundAny = cursor.findNext();
indicateHasMatches();
}
@@ -563,7 +578,7 @@ define(function (require, exports, module) {
* In that case, we don't want to change the selection unnecessarily.
*/
function handleQueryChange(editor, state, initial) {
- state.query = parseQuery($("#find-what").val());
+ state.query = parseQuery(_getModalBarItem(".find-what").val());
updateResultSet(editor);
if (state.query) {
@@ -596,14 +611,14 @@ define(function (require, exports, module) {
// If a previous search/replace bar was open, capture its query text for use below
var initialQuery;
if (modalBar) {
- initialQuery = $("#find-what").val();
+ initialQuery = _getModalBarItem(".find-what").val();
}
// Create the search bar UI (closing any previous modalBar in the process)
var htmlContent = Mustache.render(searchBarTemplate, $.extend(templateVars, Strings));
createModalBar(htmlContent);
- addShortcutToTooltip($("#find-next"), Commands.CMD_FIND_NEXT);
- addShortcutToTooltip($("#find-prev"), Commands.CMD_FIND_PREVIOUS);
+ addShortcutToTooltip(_getModalBarItem(".find-next"), Commands.CMD_FIND_NEXT);
+ addShortcutToTooltip(_getModalBarItem(".find-prev"), Commands.CMD_FIND_PREVIOUS);
$(modalBar).on("close", function (e, query) {
// Clear highlights but leave search state in place so Find Next/Previous work after closing
@@ -613,19 +628,19 @@ define(function (require, exports, module) {
toggleHighlighting(editor, false);
// Hide error popup, since it hangs down low enough to make the slide-out look awkward
- $(".modal-bar .error").hide();
+ _getModalBarItem(".error").hide();
});
modalBar.getRoot()
- .on("click", "#find-next", function (e) {
+ .on("click", ".find-next", function (e) {
findNext(editor);
})
- .on("click", "#find-prev", function (e) {
+ .on("click", ".find-prev", function (e) {
findNext(editor, true);
})
- .on("click", "#find-case-sensitive, #find-regexp", function (e) {
+ .on("click", ".find-case-sensitive, .find-regexp", function (e) {
$(e.currentTarget).toggleClass('active');
- _updatePrefsFromSearchBar();
+ _updatePrefsFromSearchBar(modalBar);
handleQueryChange(editor, state);
})
@@ -639,7 +654,7 @@ define(function (require, exports, module) {
}
});
- $("#find-what").on("input", function () {
+ _getModalBarItem(".find-what").on("input", function () {
handleQueryChange(editor, state);
});
@@ -657,10 +672,10 @@ define(function (require, exports, module) {
}
// Initial UI state
- $("#find-what")
+ _getModalBarItem(".find-what")
.val(initialQuery)
.get(0).select();
- _updateSearchBarFromPrefs();
+ _updateSearchBarFromPrefs(modalBar);
handleQueryChange(editor, state, true);
}
@@ -804,7 +819,7 @@ define(function (require, exports, module) {
/** Shows the Find-Replace search bar at top */
function replace(editor) {
// If Replace bar already open, treat the shortcut as a hotkey for the Replace button
- var $replaceBtn = $("#replace-yes");
+ var $replaceBtn = _getModalBarItem(".replace-yes");
if ($replaceBtn.length) {
if ($replaceBtn.is(":enabled")) {
$replaceBtn.click();
@@ -813,17 +828,17 @@ define(function (require, exports, module) {
}
openSearchBar(editor, {replace: true});
- addShortcutToTooltip($("#replace-yes"), Commands.CMD_REPLACE);
+ addShortcutToTooltip(_getModalBarItem(".replace-yes"), Commands.CMD_REPLACE);
var cm = editor._codeMirror,
state = getSearchState(cm);
function getReplaceWith() {
- return $("#replace-with").val() || "";
+ return _getModalBarItem(".replace-with").val() || "";
}
modalBar.getRoot().on("click", function (e) {
- if (e.target.id === "replace-yes") {
+ if ($(e.target).is(".replace-yes")) {
var text = getReplaceWith();
cm.replaceSelection(typeof state.query === "string" ? text : parseDollars(text, state.lastMatch));
@@ -835,20 +850,23 @@ define(function (require, exports, module) {
modalBar.close();
}
- } else if (e.target.id === "replace-all") {
+ } else if ($(e.target).is(".replace-all")) {
+ // Make sure to get the replace string before we close the modalBar, since the input field will
+ // no longer be in the DOM once we close it.
+ var replaceWith = getReplaceWith();
modalBar.close();
- _showReplaceAllPanel(editor, state.query, getReplaceWith());
+ _showReplaceAllPanel(editor, state.query, replaceWith);
}
});
// One-off hack to make Find/Replace fields a self-contained tab cycle - TODO: remove once https://trello.com/c/lTSJgOS2 implemented
modalBar.getRoot().on("keydown", function (e) {
if (e.keyCode === KeyEvent.DOM_VK_TAB && !e.ctrlKey && !e.metaKey && !e.altKey) {
- if (e.target.id === "replace-with" && !e.shiftKey) {
- $("#find-what").focus();
+ if ($(e.target).is(".replace-with") && !e.shiftKey) {
+ _getModalBarItem(".find-what").focus();
e.preventDefault();
- } else if (e.target.id === "find-what" && e.shiftKey) {
- $("#replace-with").focus();
+ } else if ($(e.target).is(".find-what") && e.shiftKey) {
+ _getModalBarItem(".replace-with").focus();
e.preventDefault();
}
}
diff --git a/src/styles/brackets.less b/src/styles/brackets.less
index 82c9f0d14f0..97adc2f795c 100644
--- a/src/styles/brackets.less
+++ b/src/styles/brackets.less
@@ -1100,7 +1100,7 @@ a, img {
}
}
- #find-what, #replace-with {
+ .find-what, .replace-with {
width: 295px;
}
@@ -1122,11 +1122,11 @@ a, img {
box-shadow: @tc-small-shadow-bottom;
}
- #find-what {
- padding-right: 62px; // room for #find-counter overlay
+ .find-what {
+ padding-right: 62px; // room for .find-counter overlay
width: 295px - (62px - 6px); // maintain width, accounting for differing padding
}
- #find-counter {
+ .find-counter {
position: absolute;
color: @tc-light-weight-quiet-text;
top: 1px;
@@ -1144,23 +1144,23 @@ a, img {
display: inline-block;
}
- #find-case-sensitive, #find-regexp {
+ .find-case-sensitive, .find-regexp {
padding: 1px 5px;
}
.button-icon { // icons must be nested inside button so we can apply padding w/o tiling icon
.sprite-icon(0, 0, 24px, 24px, "images/find-replace-sprites.svg");
background-repeat: no-repeat;
}
- #find-regexp.active .button-icon {
+ .find-regexp.active .button-icon {
.sprite-swap(0, 24px);
}
- #find-case-sensitive .button-icon {
+ .find-case-sensitive .button-icon {
.sprite-swap(0, 48px);
}
- #find-case-sensitive.active .button-icon {
+ .find-case-sensitive.active .button-icon {
.sprite-swap(0, 72px);
}
- #find-regexp.active, #find-case-sensitive.active {
+ .find-regexp.active, .find-case-sensitive.active {
background-color: @tc-highlight;
}
@@ -1170,18 +1170,18 @@ a, img {
button {
margin: 2px 1px 3px;
}
- #find-prev {
+ .find-prev {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
margin-left: 5px;
}
// Make button pairs snug
- #find-prev, #replace-yes, #find-case-sensitive {
+ .find-prev, .replace-yes, .find-case-sensitive {
border-right: none;
margin-right: 0;
}
- #find-next, #replace-all, #find-regexp {
+ .find-next, .replace-all, .find-regexp {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
margin-left: 0;
@@ -1189,12 +1189,12 @@ a, img {
// Make find field snug with options buttons
// & replace snug with replace commands
- #find-what, #replace-with {
+ .find-what, .replace-with {
margin-right: 0px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
- #find-case-sensitive, #replace-yes {
+ .find-case-sensitive, .replace-yes {
border-left: none;
margin-left: 0px;
border-radius: 0;
@@ -1255,7 +1255,7 @@ textarea.exclusions-editor {
background: @cm-current-match-highlight;
border-radius: @tc-inline-border-radius;
}
-#find-counter {
+.find-counter {
font-weight: @font-weight-semibold;
padding: 0 5px;
}
diff --git a/test/spec/FindReplace-test.js b/test/spec/FindReplace-test.js
index c1814490cd5..8f01d790aa4 100644
--- a/test/spec/FindReplace-test.js
+++ b/test/spec/FindReplace-test.js
@@ -370,10 +370,10 @@ define(function (require, exports, module) {
return tw$(".modal-bar");
}
function getSearchField() {
- return tw$("#find-what");
+ return tw$(".find-what");
}
function getReplaceField() {
- return tw$("#replace-with");
+ return tw$(".replace-with");
}
function expectSearchBarOpen() {
@@ -412,13 +412,13 @@ define(function (require, exports, module) {
}
function toggleCaseSensitive(val) {
- if (tw$("#find-case-sensitive").is(".active") !== val) {
- tw$("#find-case-sensitive").click();
+ if (tw$(".find-case-sensitive").is(".active") !== val) {
+ tw$(".find-case-sensitive").click();
}
}
function toggleRegexp(val) {
- if (tw$("#find-regexp").is(".active") !== val) {
- tw$("#find-regexp").click();
+ if (tw$(".find-regexp").is(".active") !== val) {
+ tw$(".find-regexp").click();
}
}
@@ -1110,11 +1110,11 @@ define(function (require, exports, module) {
expectSelection(fooExpectedMatches[0]);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-yes").is(":enabled")).toBe(true);
+ expect(tw$(".replace-yes").is(":enabled")).toBe(true);
enterReplaceText("bar");
- tw$("#replace-yes").click();
+ tw$(".replace-yes").click();
expectSelection(fooExpectedMatches[1]);
myEditor.setSelection(fooExpectedMatches[0].start, fooExpectedMatches[0].end);
@@ -1180,8 +1180,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-yes").is(":enabled")).toBe(true);
- tw$("#replace-yes").click();
+ expect(tw$(".replace-yes").is(":enabled")).toBe(true);
+ tw$(".replace-yes").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
expect(/Foo:modules/i.test(myEditor.getSelectedText())).toBe(true);
@@ -1200,8 +1200,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-yes").is(":enabled")).toBe(true);
- tw$("#replace-yes").click();
+ expect(tw$(".replace-yes").is(":enabled")).toBe(true);
+ tw$(".replace-yes").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
expect(/Foo:modules/i.test(myEditor.getSelectedText())).toBe(true);
@@ -1220,8 +1220,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-yes").is(":enabled")).toBe(true);
- tw$("#replace-yes").click();
+ expect(tw$(".replace-yes").is(":enabled")).toBe(true);
+ tw$(".replace-yes").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
expect(/\$0_:modules/i.test(myEditor.getSelectedText())).toBe(true);
@@ -1240,8 +1240,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-yes").is(":enabled")).toBe(true);
- tw$("#replace-yes").click();
+ expect(tw$(".replace-yes").is(":enabled")).toBe(true);
+ tw$(".replace-yes").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
expect(/Foo:modules/i.test(myEditor.getSelectedText())).toBe(true);
@@ -1260,8 +1260,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-yes").is(":enabled")).toBe(true);
- tw$("#replace-yes").click();
+ expect(tw$(".replace-yes").is(":enabled")).toBe(true);
+ tw$(".replace-yes").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
expect(/Foo:modules/i.test(myEditor.getSelectedText())).toBe(true);
@@ -1280,8 +1280,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-yes").is(":enabled")).toBe(true);
- tw$("#replace-yes").click();
+ expect(tw$(".replace-yes").is(":enabled")).toBe(true);
+ tw$(".replace-yes").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
expect(/\$2_\$10:Foo/i.test(myEditor.getSelectedText())).toBe(true);
@@ -1300,8 +1300,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-yes").is(":enabled")).toBe(true);
- tw$("#replace-yes").click();
+ expect(tw$(".replace-yes").is(":enabled")).toBe(true);
+ tw$(".replace-yes").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
expect(/Foo\$modules/i.test(myEditor.getSelectedText())).toBe(true);
@@ -1320,8 +1320,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-yes").is(":enabled")).toBe(true);
- tw$("#replace-yes").click();
+ expect(tw$(".replace-yes").is(":enabled")).toBe(true);
+ tw$(".replace-yes").click();
myEditor.setSelection({line: LINE_FIRST_REQUIRE, ch: 23}, {line: LINE_FIRST_REQUIRE, ch: 41});
expect(/_modules\/Foo-Foo\$&/i.test(myEditor.getSelectedText())).toBe(true);
@@ -1377,8 +1377,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-all").is(":enabled")).toBe(true);
- tw$("#replace-all").click();
+ expect(tw$(".replace-all").is(":enabled")).toBe(true);
+ tw$(".replace-all").click();
tw$(".replace-checked").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
@@ -1404,8 +1404,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-all").is(":enabled")).toBe(true);
- tw$("#replace-all").click();
+ expect(tw$(".replace-all").is(":enabled")).toBe(true);
+ tw$(".replace-all").click();
tw$(".replace-checked").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
@@ -1431,8 +1431,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-all").is(":enabled")).toBe(true);
- tw$("#replace-all").click();
+ expect(tw$(".replace-all").is(":enabled")).toBe(true);
+ tw$(".replace-all").click();
tw$(".replace-checked").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
@@ -1458,8 +1458,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-all").is(":enabled")).toBe(true);
- tw$("#replace-all").click();
+ expect(tw$(".replace-all").is(":enabled")).toBe(true);
+ tw$(".replace-all").click();
tw$(".replace-checked").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
@@ -1485,8 +1485,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-all").is(":enabled")).toBe(true);
- tw$("#replace-all").click();
+ expect(tw$(".replace-all").is(":enabled")).toBe(true);
+ tw$(".replace-all").click();
tw$(".replace-checked").click();
myEditor.setSelection(expectedMatch.start, expectedMatch.end);
@@ -1512,8 +1512,8 @@ define(function (require, exports, module) {
expectSelection(expectedMatch);
expect(/foo/i.test(myEditor.getSelectedText())).toBe(true);
- expect(tw$("#replace-all").is(":enabled")).toBe(true);
- tw$("#replace-all").click();
+ expect(tw$(".replace-all").is(":enabled")).toBe(true);
+ tw$(".replace-all").click();
tw$(".replace-checked").click();
myEditor.setSelection({line: LINE_FIRST_REQUIRE, ch: 23}, {line: LINE_FIRST_REQUIRE, ch: 41});