2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-29 05:14:04 +03:00

Complete Layout specs

This commit is contained in:
Jeff
2018-08-12 09:56:38 -07:00
parent 3078fa62d9
commit 1554080852
+27 -54
View File
@@ -13,58 +13,31 @@ describe("Single value options", () => {
expect(Select.vm.search).toEqual("");
});
// it('should apply the "hidden" class to the search input when a value is present', () => {
// const vm = new Vue({
// template:
// '<div><v-select ref="select" :options="options" :value="value"></v-select></div>',
// data: {
// value: "one",
// options: ["one", "two", "three"]
// }
// }).$mount();
//
// expect(vm.$children[0].inputClasses.hidden).toEqual(true);
// });
//
// it('should not apply the "hidden" class to the search input when a value is present, and the dropdown is open', done => {
// const vm = new Vue({
// template:
// '<div><v-select ref="select" :options="options" :value="value"></v-select></div>',
// data: {
// value: "one",
// options: ["one", "two", "three"],
// open: true
// }
// }).$mount();
// vm.$children[0].toggleDropdown({ target: vm.$children[0].$refs.search });
// Vue.nextTick(() => {
// Vue.nextTick(() => {
// expect(vm.$children[0].open).toEqual(true);
// expect(vm.$children[0].inputClasses.hidden).toEqual(false);
// done();
// });
// });
// });
//
// it("should not reset the search input on focus lost when clearSearchOnSelect is false", done => {
// const vm = new Vue({
// template:
// '<div><v-select ref="select" :options="options" :value="value" :clear-search-on-select="false"></v-select></div>',
// data: {
// value: "one",
// options: ["one", "two", "three"]
// }
// }).$mount();
// expect(vm.$refs.select.clearSearchOnSelect).toEqual(false);
//
// vm.$children[0].open = true;
// vm.$refs.select.search = "t";
// expect(vm.$refs.select.search).toEqual("t");
//
// vm.$children[0].onSearchBlur();
// Vue.nextTick(() => {
// expect(vm.$refs.select.search).toEqual("t");
// done();
// });
// });
it('should apply the "hidden" class to the search input when a value is present', () => {
const Select = shallowMount(VueSelect, { propsData: { value: "foo" } });
expect(Select.vm.inputClasses.hidden).toEqual(true);
});
it('should not apply the "hidden" class to the search input when a value is present, and the dropdown is open', () => {
const Select = shallowMount(VueSelect, { propsData: { value: "foo" } });
Select.vm.toggleDropdown({ target: Select.vm.$refs.search });
expect(Select.vm.open).toEqual(true);
expect(Select.vm.inputClasses.hidden).toEqual(false);
});
it("should not reset the search input on focus lost when clearSearchOnSelect is false", () => {
const Select = shallowMount(VueSelect, {
propsData: { value: "foo", clearSearchOnSelect: false }
});
expect(Select.vm.clearSearchOnSelect).toEqual(false);
Select.vm.open = true;
Select.vm.search = "t";
expect(Select.vm.search).toEqual("t");
Select.vm.onSearchBlur();
expect(Select.vm.search).toEqual("t");
});
});