selectivity-rails 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cd41b43f08c37783717975b788ce16e47394e1f
4
- data.tar.gz: 882fd6a6887214fff3d6890286d06dd4fc7e74b9
3
+ metadata.gz: c72d93809502d208c84e3646a8bd9a6038e8ec94
4
+ data.tar.gz: 01af9c1cf98f7168edbf04478c6a418827f886c3
5
5
  SHA512:
6
- metadata.gz: f04f3950356f55d3ef7fc2bf678fb137240c45d8bd29480ed716fe8da8f3f85e215f73f77cf0c2c51ec37d5425c105b37fd2a625b7434a9417d7debe8103cbeb
7
- data.tar.gz: e88316785228fac112e55256cbe16a291fea233d293a727f9d544840c9942aaf9a812ce8cc3698c288f33476b9b5e4a7e73fe47a3956163a07183c8d276d1012
6
+ metadata.gz: 6544d7e3140e111b5db9a6203a7f24e4e6b82dff755fa7330bde3c473d754469eca1efeaff133b187eab061b0dde8d9394f24bb046d4dacdadecac8b66d33d84
7
+ data.tar.gz: 55f4746e34b60d7bed02af63c215cba5a7aaae845b60493e37f827829f4d524d5ac7b7fc4e00c6be2dd6a912768b987fd8cb8f92acc0d93cdb7525ed4215a728
@@ -1,5 +1,5 @@
1
1
  module Selectivity
2
2
  module Rails
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
@@ -52,8 +52,7 @@ module Selectivity
52
52
  input.click
53
53
 
54
54
  within 'div.selectivity-dropdown' do
55
- # if find('div.selectivity-result-item', text: item).visible?
56
- if find(:xpath, "//div[@class='selectivity-result-item'][contains(text(), '#{item}')]").visible?
55
+ if find('div.selectivity-result-item', text: item).visible?
57
56
  page.evaluate_script("$('div.selectivity-result-item:contains(#{item})').trigger('click')")
58
57
  end
59
58
  end
@@ -303,7 +303,7 @@ var latestQueryNum = 0;
303
303
  Selectivity.OptionListeners.push(function(selectivity, options) {
304
304
 
305
305
  var query = options.query;
306
- if (query) {
306
+ if (query && !query._async) {
307
307
  options.query = function(queryOptions) {
308
308
  latestQueryNum++;
309
309
  var queryNum = latestQueryNum;
@@ -322,6 +322,7 @@ Selectivity.OptionListeners.push(function(selectivity, options) {
322
322
  };
323
323
  query(queryOptions);
324
324
  };
325
+ options.query._async = true;
325
326
  }
326
327
  });
327
328
 
@@ -2342,6 +2343,8 @@ function SelectivityDropdown(options) {
2342
2343
  */
2343
2344
  this.selectivity = selectivity;
2344
2345
 
2346
+ this._closed = false;
2347
+
2345
2348
  this._closeProxy = this.close.bind(this);
2346
2349
  if (selectivity.options.closeOnSelect !== false) {
2347
2350
  selectivity.$el.on('selectivity-selecting', this._closeProxy);
@@ -2400,17 +2403,21 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
2400
2403
  */
2401
2404
  close: function() {
2402
2405
 
2403
- if (this.options.showSearchInput) {
2404
- this.selectivity.removeSearchInput();
2405
- }
2406
+ if (!this._closed) {
2407
+ this._closed = true;
2406
2408
 
2407
- this.$el.remove();
2409
+ if (this.options.showSearchInput) {
2410
+ this.selectivity.removeSearchInput();
2411
+ }
2408
2412
 
2409
- this.removeCloseHandler();
2413
+ this.$el.remove();
2410
2414
 
2411
- this.selectivity.$el.off('selectivity-selecting', this._closeProxy);
2415
+ this.removeCloseHandler();
2412
2416
 
2413
- this.triggerClose();
2417
+ this.selectivity.$el.off('selectivity-selecting', this._closeProxy);
2418
+
2419
+ this.triggerClose();
2420
+ }
2414
2421
  },
2415
2422
 
2416
2423
  /**
@@ -2422,8 +2429,7 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
2422
2429
  'click .selectivity-load-more': '_loadMoreClicked',
2423
2430
  'click .selectivity-result-item': '_resultClicked',
2424
2431
  'mouseenter .selectivity-load-more': '_loadMoreHovered',
2425
- 'mouseenter .selectivity-result-item': '_resultHovered',
2426
- 'mousemove': '_recordMousePosition'
2432
+ 'mouseenter .selectivity-result-item': '_resultHovered'
2427
2433
  },
2428
2434
 
2429
2435
  /**
@@ -3012,8 +3018,8 @@ function listener(selectivity, $input) {
3012
3018
  }
3013
3019
 
3014
3020
  var top = position.top;
3015
- var elHeight = $el.height();
3016
3021
  var resultsHeight = dropdown.$results.height();
3022
+ var elHeight = ($el.outerHeight ? $el.outerHeight() : $el.height());
3017
3023
  if (top < 0 || top > resultsHeight - elHeight) {
3018
3024
  top += dropdown.$results.scrollTop();
3019
3025
  dropdown.$results.scrollTop(delta < 0 ? top : top - resultsHeight + elHeight);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selectivity-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konrad Jurkowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-14 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler