From ac254ff68dc5d3517d8211021944c6bec9f9f364 Mon Sep 17 00:00:00 2001 From: Kevin Brown Date: Sun, 27 Mar 2016 15:16:22 -0400 Subject: [PATCH] Added tests for jQuery calls to Select2 This adds a test that covers the change made in c2c1aeef31c95c6df5545c900a4e1782d712497c. --- tests/integration.html | 1 + tests/integration/jquery-calls.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/integration/jquery-calls.js diff --git a/tests/integration.html b/tests/integration.html index 9c7e8f87..83f6b9ba 100644 --- a/tests/integration.html +++ b/tests/integration.html @@ -14,6 +14,7 @@ + diff --git a/tests/integration/jquery-calls.js b/tests/integration/jquery-calls.js new file mode 100644 index 00000000..78d969d2 --- /dev/null +++ b/tests/integration/jquery-calls.js @@ -0,0 +1,28 @@ +test('multiple elements with arguments works', function (assert) { + var $ = require('jquery'); + require('jquery.select2'); + + var $first = $( + '' + ); + var $second = $first.clone(); + + var $both = $first.add($second); + $both.select2(); + + $both.select2('val', '2'); + + assert.equal( + $first.val(), + '2', + 'The call should change the value on the first element' + ); + assert.equal( + $second.val(), + '2', + 'The call should also change the value on the second element' + ); +}); \ No newline at end of file