How to use the ng-zorro-antd/core.createMouseEvent function in ng-zorro-antd

To help you get started, we’ve selected a few ng-zorro-antd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NG-ZORRO / ng-zorro-antd / components / cascader / nz-cascader.spec.ts View on Github external
it('should clear timer on option mouseenter and mouseleave', fakeAsync(() => {
      const mouseenter = createMouseEvent('mouseenter');
      const mouseleave = createMouseEvent('mouseleave');
      const option = options1[0]; // zhejiang

      testComponent.nzExpandTrigger = 'hover';
      fixture.detectChanges();
      expect(testComponent.cascader.menuVisible).toBe(false);
      testComponent.cascader.setMenuVisible(true);
      fixture.detectChanges();
      expect(testComponent.cascader.menuVisible).toBe(true);
      flush();
      fixture.detectChanges();
      const optionEl = getItemAtColumnAndRow(1, 1)!;
      expect(optionEl.classList).not.toContain('ant-cascader-menu-item-active');

      testComponent.cascader.onOptionMouseEnter(option, 0, mouseenter);
      fixture.detectChanges();
github NG-ZORRO / ng-zorro-antd / components / dropdown / nz-dropdown.spec.ts View on Github external
it('should create dropdown', () => {
      const fakeEvent = createMouseEvent('contextmenu', 300, 300);
      testComponent.nzDropdownService.create(fakeEvent, testComponent.template);
      fixture.detectChanges();
      expect(overlayContainerElement.textContent).not.toBe('');
      // https://github.com/angular/material2/pull/12119
      // TODO: fix
      // expect(window.getComputedStyle(overlayPane, null).top).toBe(`${300 - overlayContainerElement.getBoundingClientRect().top}px`);
      testComponent.nzDropdownService.dispose();
      fixture.detectChanges();
      expect(overlayContainerElement.textContent).toBe('');
    });
    it('should only one dropdown exist', () => {
github NG-ZORRO / ng-zorro-antd / components / dropdown / nz-dropdown.spec.ts View on Github external
it('should change contextmenu after create', fakeAsync(() => {
      const fakeEvent = createMouseEvent('contextmenu', 100, 100);
      testComponent.nzDropdownService.create(fakeEvent, testComponent.template);
      fixture.detectChanges();
      tick(500);
      fixture.detectChanges();
      const fakeContextEvent = createMouseEvent('contextmenu', 200, 200);
      testComponent.nzDropdownService.create(fakeContextEvent, testComponent.template);
      fixture.detectChanges();
      tick(1000);
      fixture.detectChanges();
      // @ts-ignore
      const overlayElement = testComponent.nzDropdownService.overlayRef.overlayElement;
      expect(overlayElement.textContent).not.toBe('');
    }));
  });
github NG-ZORRO / ng-zorro-antd / components / cascader / nz-cascader.spec.ts View on Github external
it('should clear timer on option mouseenter and mouseleave', fakeAsync(() => {
      const mouseenter = createMouseEvent('mouseenter');
      const mouseleave = createMouseEvent('mouseleave');
      const option = options1[0]; // zhejiang

      testComponent.nzExpandTrigger = 'hover';
      fixture.detectChanges();
      expect(testComponent.cascader.menuVisible).toBe(false);
      testComponent.cascader.setMenuVisible(true);
      fixture.detectChanges();
      expect(testComponent.cascader.menuVisible).toBe(true);
      flush();
      fixture.detectChanges();
      const optionEl = getItemAtColumnAndRow(1, 1)!;
      expect(optionEl.classList).not.toContain('ant-cascader-menu-item-active');

      testComponent.cascader.onOptionMouseEnter(option, 0, mouseenter);
      fixture.detectChanges();
      tick(10);
github NG-ZORRO / ng-zorro-antd / components / dropdown / nz-dropdown.spec.ts View on Github external
it('should only one dropdown exist', () => {
      let fakeEvent = createMouseEvent('contextmenu', 0, 0);
      testComponent.nzDropdownService.create(fakeEvent, testComponent.template);
      fixture.detectChanges();
      expect(overlayContainerElement.textContent).not.toBe('');
      fakeEvent = createMouseEvent('contextmenu', window.innerWidth, window.innerHeight);
      testComponent.nzDropdownService.create(fakeEvent, testComponent.template);
      fixture.detectChanges();
      expect(overlayContainerElement.textContent).toBe('');
    });
    it('should dropdown close when scroll', () => {
github NG-ZORRO / ng-zorro-antd / components / dropdown / nz-dropdown.spec.ts View on Github external
it('should backdrop work with click', fakeAsync(() => {
      const fakeEvent = createMouseEvent('contextmenu', 100, 100);
      testComponent.nzDropdownService.create(fakeEvent, testComponent.template);
      fixture.detectChanges();
      expect(overlayContainerElement.textContent).not.toBe('');
      document.body.click();
      tick(500);
      fixture.detectChanges();
      expect(overlayContainerElement.textContent).toBe('');
    }));
    it('should change contextmenu after create', fakeAsync(() => {
github NG-ZORRO / ng-zorro-antd / components / dropdown / nz-dropdown.spec.ts View on Github external
it('should only one dropdown exist', () => {
      let fakeEvent = createMouseEvent('contextmenu', 0, 0);
      testComponent.nzDropdownService.create(fakeEvent, testComponent.template);
      fixture.detectChanges();
      expect(overlayContainerElement.textContent).not.toBe('');
      fakeEvent = createMouseEvent('contextmenu', window.innerWidth, window.innerHeight);
      testComponent.nzDropdownService.create(fakeEvent, testComponent.template);
      fixture.detectChanges();
      expect(overlayContainerElement.textContent).toBe('');
    });
    it('should dropdown close when scroll', () => {
github NG-ZORRO / ng-zorro-antd / components / dropdown / nz-dropdown.spec.ts View on Github external
it('should animation work', () => {
      const fakeEvent = createMouseEvent('contextmenu', 500, 500);
      const contextComponent = testComponent.nzDropdownService.create(fakeEvent, testComponent.template);
      fixture.detectChanges();
      expect(overlayContainerElement.textContent).not.toBe('');
      contextComponent.close();
      contextComponent.afterAnimation();
      fixture.detectChanges();
      expect(overlayContainerElement.textContent).toBe('');
    });
    it('should backdrop work with click', fakeAsync(() => {