Skip to content

Commit 2321c2c

Browse files
committed
set the custom clearSearchButtonText in a timing independent way
1 parent a005fb4 commit 2321c2c

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

tests/unit/textinput/index.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@
1111
<script src="../../../tests/jquery.testHelper.js"></script>
1212
<script>
1313
$.testHelper.asyncLoad([
14-
[
15-
"jquery.mobile.forms.textinput"
16-
],
14+
[ "jquery.mobile.forms.textinput" ],
15+
[ "settings.js" ],
1716
[ "jquery.mobile.init" ],
18-
[
19-
"textinput_core.js"
20-
]
17+
[ "textinput_core.js" ]
2118
]);
2219
</script>
2320

@@ -56,7 +53,7 @@ <h2 id="qunit-userAgent"></h2>
5653
<textarea id="keyup-autogrow">
5754
</textarea>
5855
<a href="external.html" id="external">external</a>
59-
56+
6057
<input type="search" id="search-input">
6158
</div>
6259
</body>

tests/unit/textinput/settings.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
$( document ).bind("mobileinit", function(){
2+
$.mobile.textinput.prototype.options.clearSearchButtonText = "custom value";
3+
});

tests/unit/textinput/textinput_core.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@
5858
}
5959
]);
6060
});
61-
62-
$.mobile.textinput.prototype.options.clearSearchButtonText = "custom value";
63-
64-
test( "\"clear text\" button for search inputs should use configured text", function(){
61+
62+
// NOTE init binding to alter the setting is in settings.js
63+
test( "'clear text' button for search inputs should use configured text", function(){
6564
strictEqual( $( "#search-input" ).closest( ".ui-input-search" ).find( ".ui-input-clear" ).attr( "title" ), "custom value" );
6665
});
6766
})(jQuery);

0 commit comments

Comments
 (0)