asva-vue-filters
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -38,3 +38,2 @@ import _ from 'lodash' | ||
this.bus.$on('set-filters', function (filters) { | ||
console.log(filters) | ||
self.setFilters(filters) | ||
@@ -41,0 +40,0 @@ }) |
{ | ||
"name": "asva-vue-filters", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Decoupled filter block for vue.js. Mixins and example components", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,6 +10,8 @@ import Vue from 'vue' | ||
var filterChangedSpy = jasmine.createSpy('filter-changed') | ||
var filterDisabledSpy = jasmine.createSpy('filter-disabled') | ||
var changeCount = 0 | ||
var lastFilters = {} | ||
var disableCount = 0 | ||
var disableKey = '' | ||
beforeEach(function() { | ||
beforeEach(function () { | ||
@@ -20,16 +22,24 @@ var parentComponent = { | ||
name="order" | ||
:bus="bus" | ||
v-ref:child | ||
></vm-sorting-order-filter> | ||
`, | ||
ready() { | ||
this.bus.$on('change', function (filters) { | ||
changeCount += 1 | ||
lastFilters = filters | ||
}) | ||
this.bus.$on('disable', function (key) { | ||
disableCount += 1 | ||
disableKey = key | ||
}) | ||
}, | ||
components: { | ||
vmSortingOrderFilter | ||
}, | ||
events: { | ||
'filter-changed': function (filters){ | ||
filterChangedSpy(filters) | ||
}, | ||
'filter-disabled': function (key){ | ||
filterDisabledSpy(key) | ||
}, | ||
} | ||
data(){ | ||
return { | ||
bus: new Vue, | ||
} | ||
}, | ||
} | ||
@@ -56,15 +66,15 @@ | ||
expect(getClass(child)).toBe('fa fa-sort-asc'); | ||
expect(filterChangedSpy.calls.count()).toBe(1) | ||
expect(filterChangedSpy.calls.mostRecent().args[0]).toEqual({'order': 'asc'}) | ||
expect(changeCount).toBe(1) | ||
expect(lastFilters).toEqual({'order': 'asc'}) | ||
$(child.$el).click() | ||
Vue.nextTick(function () { | ||
expect(getClass(child)).toBe('fa fa-sort-desc') | ||
expect(filterChangedSpy.calls.count()).toBe(2) | ||
expect(filterChangedSpy.calls.mostRecent().args[0]).toEqual({'order': 'desc'}) | ||
expect(changeCount).toBe(2) | ||
expect(lastFilters).toEqual({'order': 'desc'}) | ||
$(child.$el).click() | ||
Vue.nextTick(function () { | ||
expect(getClass(child)).toBe('fa fa-sort'); | ||
expect(filterDisabledSpy.calls.count()).toBe(1) | ||
expect(filterDisabledSpy.calls.mostRecent().args[0]).toBe('order') | ||
done(); | ||
expect(getClass(child)).toBe('fa fa-sort') | ||
expect(disableCount).toBe(1) | ||
expect(disableKey).toBe('order') | ||
done() | ||
}) | ||
@@ -71,0 +81,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38771
339