How to use the simulate-event.simulate function in simulate-event

To help you get started, we’ve selected a few simulate-event 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 gocd / gocd / server / webapp / WEB-INF / rails.new / spec / webpack / views / pipeline_configs / cancel_task_widget_spec.js View on Github external
attributes: {
            build_file:        'build-moduleA.xml',
            target:            'clean',
            working_directory: "moduleA",
            nant_path:         "C:\\NAnt",
            run_if:            []
          }
        }
      });
      /* eslint-enable camelcase */

      mount(task);

      const dropDown = $root.find('.on-cancel select').get(0);
      $(dropDown).val('exec');
      simulateEvent.simulate(dropDown, 'change');

      m.redraw();

      expect(task.onCancelTask.type()).toBe('exec');
      expect($root.find("input[data-prop-name='command']")).toHaveValue(task.onCancelTask.command());

      unmount();
    });
github jupyterlab / lumino / test / src / ui / tabbar.spec.ts View on Github external
it('should be emitted when a tab close icon is clicked', () => {
        let rect = closeIcon.getBoundingClientRect();
        let called = false;
        bar.tabCloseRequested.connect((sender, args) => {
          expect(sender).to.be(bar);
          expect(args.index).to.be(0);
          expect(args.title).to.be(bar.titles.at(0));
          called = true;
        });
        simulate(closeIcon, 'click', { clientX: rect.left, clientY: rect.top });
        expect(called).to.be(true);
      });
github jupyterlab / lumino / test / src / ui / tabbar.spec.ts View on Github external
it('should do nothing if the click is not on a tab', () => {
          let rect = closeIcon.getBoundingClientRect();
          let called = false;
          bar.tabCloseRequested.connect((sender, args) => { called = true; });
          simulate(tab, 'click', { clientX: rect.left, clientY: rect.top });
          expect(called).to.be(false);
        });
github jupyterlab / lumino / tests / test-widgets / src / tabbar.spec.ts View on Github external
it('should do nothing if not a left mouse press', () => {
          let rect = tab.getBoundingClientRect();
          simulate(tab, 'mousedown', { clientX: rect.left, clientY: rect.top, button: 1 });
          simulate(document.body, 'mousemove');
          expect(bar.events.indexOf('mousemove')).to.equal(-1);
        });
github jupyterlab / lumino / tests / test-widgets / src / tabbar.spec.ts View on Github external
it('should be emitted when a tab close icon is left clicked', () => {
        let called = false;
        let rect = closeIcon.getBoundingClientRect();
        bar.tabCloseRequested.connect((sender, args) => {
          expect(sender).to.equal(bar);
          expect(args.index).to.equal(0);
          expect(args.title).to.equal(bar.titles[0]);
          called = true;
        });
        simulate(closeIcon, 'mousedown', { clientX: rect.left, clientY: rect.top, button: 0 });
        simulate(closeIcon, 'mouseup', { clientX: rect.left, clientY: rect.top, button: 0 });
        expect(called).to.equal(true);
      });
github jupyterlab / jupyterlab / test / src / filebrowser / buttons.spec.ts View on Github external
it('should create a new folder', (done) => {
        Widget.attach(buttons, document.body);
        let node = buttons.createNode;
        simulate(node, 'mousedown');
        let menu = document.getElementsByClassName('p-Menu')[0];
        simulate(menu, 'keydown', { keyCode: 40 });
        simulate(menu, 'keydown', { keyCode: 13 });
        model.fileChanged.connect((sender, args) => {
          expect(args.newValue.type).to.be('directory');
          done();
        });
      });
github jupyterlab / lumino / test / src / ui / menubar.spec.ts View on Github external
it('should add event listeners', () => {
        let bar = new LogMenuBar();
        let node = bar.node;
        Widget.attach(bar, document.body);
        expect(bar.methods.indexOf('onAfterAttach')).to.not.be(-1);
        simulate(node, 'keydown');
        expect(bar.events.indexOf('keydown')).to.not.be(-1);
        simulate(node, 'mousedown');
        expect(bar.events.indexOf('mousedown')).to.not.be(-1);
        simulate(node, 'mousemove');
        expect(bar.events.indexOf('mousemove')).to.not.be(-1);
        simulate(node, 'mouseleave');
        expect(bar.events.indexOf('mouseleave')).to.not.be(-1);
        simulate(node, 'contextmenu');
        expect(bar.events.indexOf('contextmenu')).to.not.be(-1);
        bar.dispose();
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / toolbar.spec.ts View on Github external
it('Enter should activate the callback', async () => {
          let called = false;
          const button = new ToolbarButton({
            onClick: () => {
              called = true;
            }
          });
          Widget.attach(button, document.body);
          await framePromise();
          simulate(button.node.firstChild as HTMLElement, 'keydown', {
            key: 'Enter'
          });
          expect(called).to.equal(true);
          button.dispose();
        });
        it('Space should activate the callback', async () => {
github jupyterlab / jupyterlab / tests / test-apputils / src / toolbar.spec.ts View on Github external
it('Enter should activate the callback', async () => {
          let called = false;
          const button = new ToolbarButton({
            onClick: () => {
              called = true;
            }
          });
          Widget.attach(button, document.body);
          await framePromise();
          simulate(button.node.firstChild as HTMLElement, 'keydown', {
            key: 'Enter'
          });
          expect(called).to.equal(true);
          button.dispose();
        });
        it('Space should activate the callback', async () => {
github jupyterlab / lumino / test / src / dom / dragdrop.spec.ts View on Github external
it('should dispose of the drag if `Escape` is pressed', () => {
          simulate(document.body, 'keydown', { keyCode: 27 });
          expect(drag.isDisposed).to.be(true);
        });

simulate-event

A library for triggering DOM events.

MIT
Latest version published 8 years ago

Package Health Score

51 / 100
Full package analysis

Popular simulate-event functions