|
@@ -188,4 +188,90 @@ test('the focus event shifts the focus', function (assert) {
|
|
|
$search[0],
|
|
|
'The search did not have focus originally'
|
|
|
);
|
|
|
+});
|
|
|
+
|
|
|
+test('search box without text should propagate click', function (assert) {
|
|
|
+ assert.expect(1);
|
|
|
+
|
|
|
+ var $container = $('#qunit-fixture .event-container');
|
|
|
+ var container = new MockContainer();
|
|
|
+
|
|
|
+ var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
|
|
|
+
|
|
|
+ var $element = $('#qunit-fixture .multiple');
|
|
|
+ var selection = new CustomSelection($element, options);
|
|
|
+
|
|
|
+ var $selection = selection.render();
|
|
|
+ selection.bind(container, $container);
|
|
|
+
|
|
|
+ // Update the selection so the search is rendered
|
|
|
+ selection.update([]);
|
|
|
+
|
|
|
+ // Make it visible so the browser can place focus on the search
|
|
|
+ $container.append($selection);
|
|
|
+
|
|
|
+ $selection.on('click', function () {
|
|
|
+ assert.ok(true, 'The click event should not have been trapped');
|
|
|
+ });
|
|
|
+
|
|
|
+ var $search = $selection.find('input');
|
|
|
+ $search.trigger('click');
|
|
|
+});
|
|
|
+
|
|
|
+test('search box with text should not propagate click', function (assert) {
|
|
|
+ assert.expect(0);
|
|
|
+
|
|
|
+ var $container = $('#qunit-fixture .event-container');
|
|
|
+ var container = new MockContainer();
|
|
|
+
|
|
|
+ var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
|
|
|
+
|
|
|
+ var $element = $('#qunit-fixture .multiple');
|
|
|
+ var selection = new CustomSelection($element, options);
|
|
|
+
|
|
|
+ var $selection = selection.render();
|
|
|
+ selection.bind(container, $container);
|
|
|
+
|
|
|
+ // Update the selection so the search is rendered
|
|
|
+ selection.update([]);
|
|
|
+
|
|
|
+ // Make it visible so the browser can place focus on the search
|
|
|
+ $container.append($selection);
|
|
|
+
|
|
|
+ $selection.on('click', function () {
|
|
|
+ assert.ok(false, 'The click event should have been trapped');
|
|
|
+ });
|
|
|
+
|
|
|
+ var $search = $selection.find('input');
|
|
|
+ $search.val('test');
|
|
|
+ $search.trigger('click');
|
|
|
+});
|
|
|
+
|
|
|
+test('search box with text should not close dropdown', function (assert) {
|
|
|
+ assert.expect(0);
|
|
|
+
|
|
|
+ var $container = $('#qunit-fixture .event-container');
|
|
|
+ var container = new MockContainer();
|
|
|
+
|
|
|
+ var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
|
|
|
+
|
|
|
+ var $element = $('#qunit-fixture .multiple');
|
|
|
+ var selection = new CustomSelection($element, options);
|
|
|
+
|
|
|
+ var $selection = selection.render();
|
|
|
+ selection.bind(container, $container);
|
|
|
+
|
|
|
+ // Update the selection so the search is rendered
|
|
|
+ selection.update([]);
|
|
|
+
|
|
|
+ // Make it visible so the browser can place focus on the search
|
|
|
+ $container.append($selection);
|
|
|
+
|
|
|
+ container.on('close', function () {
|
|
|
+ assert.ok(false, 'The dropdown should not have closed');
|
|
|
+ });
|
|
|
+
|
|
|
+ var $search = $selection.find('input');
|
|
|
+ $search.val('test');
|
|
|
+ $search.trigger('click');
|
|
|
});
|