mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
autocomplete: added init/destroy tests
This commit is contained in:
parent
9b8fccfa4a
commit
ac86d4c6db
@ -19,6 +19,8 @@
|
||||
<h1>jQuery - Autocomplete Test Suite</h1>
|
||||
<div id="main" style="display: none">
|
||||
|
||||
<input type="text" name="autocomplete" value="" id="autocomplete">
|
||||
|
||||
</div>
|
||||
|
||||
<ol id="tests"></ol>
|
||||
|
@ -1,3 +1,48 @@
|
||||
test("init", function() {
|
||||
expect(6);
|
||||
|
||||
el = $("#autocomplete").autocomplete();
|
||||
ok(true, '.autocomplete() called on element');
|
||||
|
||||
$([]).autocomplete();
|
||||
ok(true, '.autocomplete() called on empty collection');
|
||||
|
||||
$("<input/>").autocomplete();
|
||||
ok(true, '.autocomplete() called on disconnected DOMElement');
|
||||
|
||||
$("<input/>").autocomplete().autocomplete("foo");
|
||||
ok(true, 'arbitrary method called after init');
|
||||
|
||||
$("<input/>").autocomplete().data("foo.autocomplete");
|
||||
ok(true, 'arbitrary option getter after init');
|
||||
|
||||
$("<input/>").autocomplete().data("foo.autocomplete", "bar");
|
||||
ok(true, 'arbitrary option setter after init');
|
||||
});
|
||||
|
||||
test("destroy", function() {
|
||||
expect(6);
|
||||
|
||||
$("#autocomplete").autocomplete().autocomplete("destroy");
|
||||
ok(true, '.autocomplete("destroy") called on element');
|
||||
|
||||
$([]).autocomplete().autocomplete("destroy");
|
||||
ok(true, '.autocomplete("destroy") called on empty collection');
|
||||
|
||||
$("<input/>").autocomplete().autocomplete("destroy");
|
||||
ok(true, '.autocomplete("destroy") called on disconnected DOMElement');
|
||||
|
||||
$("<input/>").autocomplete().autocomplete("destroy").autocomplete("foo");
|
||||
ok(true, 'arbitrary method called after destroy');
|
||||
|
||||
$("<input/>").autocomplete().autocomplete("destroy").data("foo.autocomplete");
|
||||
ok(true, 'arbitrary option getter after destroy');
|
||||
|
||||
$("<input/>").autocomplete().autocomplete("destroy").data("foo.autocomplete", "bar");
|
||||
ok(true, 'arbitrary option setter after destroy');
|
||||
});
|
||||
|
||||
|
||||
test("highlighter", function() {
|
||||
equals( jQuery.Autocompleter.defaults.highlight("Peter", "Pe"), "<strong>Pe</strong>ter" );
|
||||
equals( jQuery.Autocompleter.defaults.highlight("Peter <em><Pan></em>", "Pe"), "<strong>Pe</strong>ter <em><Pan></em>" );
|
||||
|
Loading…
Reference in New Issue
Block a user