summaryrefslogtreecommitdiffstats
path: root/src/app/shared/directives/dropdownopen.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/shared/directives/dropdownopen.spec.ts')
-rw-r--r--src/app/shared/directives/dropdownopen.spec.ts51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/app/shared/directives/dropdownopen.spec.ts b/src/app/shared/directives/dropdownopen.spec.ts
new file mode 100644
index 0000000..b7a7aa6
--- /dev/null
+++ b/src/app/shared/directives/dropdownopen.spec.ts
@@ -0,0 +1,51 @@
+import { DropdownOpen } from './dropdownopen';
+import { Dropdown } from './dropdown';
+import { ElementRef, Host, HostListener } from '@angular/core';
+import { async, TestBed, inject } from '@angular/core/testing';
+
+
+describe('DropdownOpen', () => {
+ let directive;
+ let dropdown = new Dropdown(new ElementRef(''));
+
+ beforeEach(() => {
+ directive = new DropdownOpen(dropdown, new ElementRef(''));
+ });
+
+ it('should create an instance', () => {
+ expect(directive).toBeTruthy();
+ });
+
+ describe('should validate on Host click event', () => {
+ it('should validate openDropdown method if activateOnFocus, openedByFocus are true', () => {
+ let event = new Event('click');
+ let dispatchEvent = window.dispatchEvent(event);
+ dropdown.activateOnFocus = true;
+ directive.openedByFocus = true;
+
+ directive.openDropdown();
+ });
+
+ it('should validate openDropdown method if dropdown.isOpened(), dropdown.toggleClick false', () => {
+ });
+ });
+
+ it('should validate on Host keydown event', () => {
+ let spy = spyOn(directive, 'openDropdown')
+ var event = new KeyboardEvent("keydown");
+
+ Object.defineProperty(event, "keyCode", {"value" : 40})
+
+ directive.dropdownKeydown(event);
+
+ expect(spy).toHaveBeenCalled()
+ });
+
+ it('should validate on Host focus event', () => {
+
+ dropdown.activateOnFocus = false;
+
+ directive.onFocus();
+
+ });
+}); \ No newline at end of file