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

- bind scope to open-indicator-icon slot (#860)

- explicitly set v-if on OpenIndicator
- only add searching and searchable state classes if noDrop is false
- only add OpenIndicator to toggleTargets if the $ref exists
This commit is contained in:
Jeff Sagal
2019-04-28 16:09:48 -07:00
committed by GitHub
parent 7d72db3134
commit eb2f8f835c
2 changed files with 49 additions and 8 deletions
+37
View File
@@ -1,4 +1,5 @@
import { selectWithProps } from "../helpers";
import OpenIndicator from "../../src/components/OpenIndicator";
describe("Toggling Dropdown", () => {
it("should not open the dropdown when the el is clicked but the component is disabled", () => {
@@ -127,4 +128,40 @@ describe("Toggling Dropdown", () => {
Select.vm.open = true;
expect(Select.vm.stateClasses['vs--open']).toEqual(true);
});
it("should not display the dropdown if noDrop is true", () => {
const Select = selectWithProps({
noDrop: true,
});
Select.vm.toggleDropdown({ target: Select.vm.$refs.search });
expect(Select.vm.open).toEqual(true);
expect(Select.contains('.vs__dropdown-menu')).toBeFalsy();
expect(Select.vm.stateClasses['vs--open']).toBeFalsy();
});
it("should hide the open indicator if noDrop is true", () => {
const Select = selectWithProps({
noDrop: true,
});
expect(Select.contains(OpenIndicator)).toBeFalsy();
});
it("should not add the searchable state class when noDrop is true", () => {
const Select = selectWithProps({
noDrop: true,
});
expect(Select.classes('vs--searchable')).toBeFalsy();
});
it("should not add the searching state class when noDrop is true", () => {
const Select = selectWithProps({
noDrop: true,
});
Select.vm.search = 'Canada';
expect(Select.classes('vs--searching')).toBeFalsy();
});
});