summaryrefslogtreecommitdiff
path: root/js_tests/admin/SelectBox.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'js_tests/admin/SelectBox.test.js')
-rw-r--r--js_tests/admin/SelectBox.test.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/js_tests/admin/SelectBox.test.js b/js_tests/admin/SelectBox.test.js
new file mode 100644
index 0000000000..b2e36e0ab2
--- /dev/null
+++ b/js_tests/admin/SelectBox.test.js
@@ -0,0 +1,20 @@
+module('admin.SelectBox');
+
+test('init: no options', function(assert) {
+ var $ = django.jQuery;
+ $('<select id="id"></select>').appendTo('#qunit-fixture');
+ SelectBox.init('id');
+ assert.equal(SelectBox.cache['id'].length, 0);
+});
+
+test('filter', function(assert) {
+ var $ = django.jQuery;
+ $('<select id="id"></select>').appendTo('#qunit-fixture');
+ $('<option value="0">A</option>').appendTo('#id');
+ $('<option value="1">B</option>').appendTo('#id');
+ SelectBox.init('id');
+ assert.equal($('#id option').length, 2);
+ SelectBox.filter('id', "A");
+ assert.equal($('#id option').length, 1);
+ assert.equal($('#id option').text(), "A");
+});