diff --git a/README.md b/README.md
index f913f9a..1becf03 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,8 @@ Rather than bringing in jQuery just to use Select2 or Chosen, this Vue.js compon
#### Features
-- **Tagging Support (+v.1.1.0)**
+- **AJAX Support +v1.2.0**
+- Tagging Support **+v.1.1.0**
- No JS Dependencies
- List Filtering/Searching
- Supports Vuex
@@ -17,9 +18,9 @@ Rather than bringing in jQuery just to use Select2 or Chosen, this Vue.js compon
#### Upcoming/In Progress
-- ~~Tagging (adding options not present in list, see `taggable` branch)~~ **added in v.1.1.0**
+- ~~Tagging (adding options not present in list, see `taggable` branch)~~ **+v.1.1.0**
+- ~~Asyncronous Option Loading~~ **+v.1.2.0**
- Rich Option Templating
-- Asyncronous Option Loading
## Live Examples & Docs
[http://sagalbot.github.io/vue-select/](http://sagalbot.github.io/vue-select/)
diff --git a/src/components/Select.vue b/src/components/Select.vue
index 4cf2d01..5851c5b 100644
--- a/src/components/Select.vue
+++ b/src/components/Select.vue
@@ -1,611 +1,619 @@
-
diff --git a/test/unit/specs/Select.spec.js b/test/unit/specs/Select.spec.js
index 86c02dc..bec61aa 100644
--- a/test/unit/specs/Select.spec.js
+++ b/test/unit/specs/Select.spec.js
@@ -190,31 +190,56 @@ describe('Select.vue', () => {
expect(vm.$children[0].isOptionSelected('one')).toEqual(true)
})
- it('can run a callback when the selection changes', (done) => {
- const vm = new Vue({
- template: '
',
- components: {vSelect},
- data: {
- val: null,
- options: ['foo', 'bar', 'baz']
- },
- methods: {
- foo(value) {
- this.val = value
+ describe('onChange Callback', () => {
+ it('can run a callback when the selection changes', (done) => {
+ const vm = new Vue({
+ template: `
`,
+ components: {vSelect},
+ methods: {
+ cb(val) {
+ }
}
- }
- }).$mount()
+ }).$mount()
- vm.$children[0].select('foo')
- Vue.nextTick(function () {
- expect(vm.$get('val')).toEqual('foo')
+ spyOn(vm.$children[0], 'onChange')
- vm.$children[0].$set('value', 'baz')
- Vue.nextTick(function () {
- expect(vm.$get('val')).toEqual('baz')
- done()
+ vm.$children[0].select('bar')
+
+ Vue.nextTick(() => {
+ expect(vm.$children[0].onChange).toHaveBeenCalledWith('bar')
+ vm.$children[0].select('baz')
+
+ Vue.nextTick(() => {
+ expect(vm.$children[0].onChange).toHaveBeenCalledWith('baz')
+ done()
+ })
})
})
+
+ it('should run onChange when multiple is true and the value changes', (done) => {
+ const vm = new Vue({
+ template: `
`,
+ methods: {
+ cb(val) {
+ }
+ }
+ }).$mount()
+
+ spyOn(vm.$children[0], 'onChange')
+
+ vm.$children[0].select('bar')
+
+ Vue.nextTick(() => {
+ expect(vm.$children[0].onChange).toHaveBeenCalledWith(['foo','bar'])
+ vm.$children[0].select('baz')
+
+ Vue.nextTick(() => {
+ expect(vm.$children[0].onChange).toHaveBeenCalledWith(['foo','bar','baz'])
+ done()
+ })
+ })
+
+ })
})
})