Esempio n. 1
0
export const clickDown = () =>
  Simulate.keyDown(input, { key: 'ArrowDown' });
Esempio n. 2
0
function click(comp) {
  TestUtils.Simulate.click(comp);
}
Esempio n. 3
0
$.fn.simulate = function(eventName, value) {
  if (value) {
    this.val(value);
  }
  TestUtils.Simulate[eventName](this[0]);
};
 it('should set the brush stroke weight in the application state', () => {
   TestUtils.Simulate.click(brush);
   const mediumWeightBrush = TestUtils.scryRenderedDOMComponentsWithClass(lineWeightSelector, 'circle-container')[2];
   TestUtils.Simulate.click(mediumWeightBrush);
   expect(app.state.toolOptions.stroke).toEqual(30);
 });
Esempio n. 5
0
function keyDown(comp, code) {
  TestUtils.Simulate.keyDown(comp.input(), {keyCode: code});
}
test('calls handleClick prop when clicked', function() {
  Simulate.click(this.DueDateRemoveRowLink.refs.removeRowIcon.getDOMNode())
  ok(this.handleClick.calledOnce)
})
 return waitFor(hasReference, 2000).then(() => {
   expect(locationTxt.value).to.equal('7,500,725-7,500,775');
   locationTxt.value = '17:7500745-7500785';
   ReactTestUtils.Simulate.click(goBtn);
 }).delay(50).then(() => {
	it('Is droppable', ()=>{
		spyOn(instance, 'drop');
		TestUtils.Simulate.drop(zone);
		expect(instance.drop).toHaveBeenCalled();
	});
	it('Has drag over', ()=>{
		spyOn(instance, 'allowDrop');
		TestUtils.Simulate.dragOver(zone);
		expect(instance.allowDrop).toHaveBeenCalled();
	});
Esempio n. 10
0
 it("Should scroll the header locked cells horizontally", function() {
     ReactTests.Simulate.scroll(ReactDOM.findDOMNode(this.canvas), {target:{scrollLeft:100, scrollTop:0}});
     expect(ReactDOM.findDOMNode(this.header).getElementsByClassName('react-grid-HeaderCell--locked')[0].style.transform).toBe("translate3d(100px, 0px, 0px)");
 });
 it('should handleRemove when user click on remove icon', () => {
   instance = renderIntoDocument(<TransactionItem { ...props } />);
   const btnRemove = findRenderedDOMComponentWithClass(instance, 'btn__remove');
   Simulate.click(btnRemove);
   props.handleRemove.should.be.calledOnce();
 });
Esempio n. 12
0
 xit("Should scroll the viewport horizontally", function() {
     ReactTests.Simulate.scroll(ReactDOM.findDOMNode(this.canvas), {target:{scrollLeft:100, scrollTop:0}});
     //TODO for some reason (even attached to a real DOM), scrollTop is still 0
     //could be React batching DOM updates?
     expect(canvas.scrollLeft).toBe(100);
 });
Esempio n. 13
0
 it("Should scroll the viewport state horizontally", function() {
     ReactTests.Simulate.scroll(ReactDOM.findDOMNode(this.canvas), {target:{scrollLeft:100, scrollTop:0}});
     expect(this.viewport.state.scrollLeft).toBe(100);
 });
Esempio n. 14
0
export const clickEnter = () =>
  Simulate.keyDown(input, { key: 'Enter' });
Esempio n. 15
0
 it('third button should call onIncrement if the counter is odd and negative', () => {
   const { buttons, actions } = setup(-43)
   TestUtils.Simulate.click(buttons[2])
   expect(actions.onIncrement).toHaveBeenCalled()
 })
const fillInText = (wrapper, text) => {
  const inputDOM = wrapper.find('input').node;
  inputDOM.value = text;
  Simulate.change(inputDOM)
};
  it('responds to close', function () {
    T.Simulate.click(close)

    // Box should be hidden.
    expect(parent.getAttribute('aria-hidden')).toBe('true')
  })
 it('change value', () => {
   const telInput = TestUtils.findRenderedComponentWithType(component, TelInput);
   findDOMNode(telInput).value = '12345';
   TestUtils.Simulate.change(findDOMNode(telInput));
   expect(telInput.props.value).toEqual('12345');
 });
Esempio n. 19
0
 runs(()=> {
     ip = this.el.querySelector('.lupa-index-project');
     TestUtils.Simulate.click(ip);
 });
 assert.doesNotThrow(() => {
   TestUtils.Simulate.click(instance.refs.button);
 });
 it('should set the pencil stroke weight in the application state', () => {
   const mediumWeightLine = TestUtils.scryRenderedDOMComponentsWithClass(lineWeightSelector, 'line-container')[2];
   TestUtils.Simulate.click(mediumWeightLine);
   expect(app.state.toolOptions.stroke).toEqual(10);
 });
Esempio n. 22
0
 return this.each(component =>
   ReactTestUtils.Simulate[event](utils.findDOMNode(component), data))
Esempio n. 23
0
function change(comp, value) {
  TestUtils.Simulate.change(comp.input(), {target: {value: value}});
}
Esempio n. 24
0
 it("should show link menu when link button is pressed", () => {
   const button = ReactDOM.findDOMNode(TestUtils.findRenderedComponentWithType(instance, LinkMenuButton));
   TestUtils.Simulate.click(button);
   const menu = TestUtils.findRenderedComponentWithType(instance, LinkMenu);
   assert.equal(menu.props.visible, true);
 });
Esempio n. 25
0
function blur(comp) {
  TestUtils.Simulate.blur(comp.input());
}
Esempio n. 26
0
 it('second button should call onDecrement', () => {
   const { buttons, actions } = setup()
   TestUtils.Simulate.click(buttons[1])
   expect(actions.onDecrement).toHaveBeenCalled()
 })
Esempio n. 27
0
 it('updates the location', () => {
   assert(!router.push.called);
   input.value = 'adblock';
   Simulate.submit(form);
   assert(router.push.calledWith('/somewhere?q=adblock'));
 });
Esempio n. 28
0
 it('third button should not call onIncrement if the counter is even', () => {
   const { buttons, actions } = setup(42)
   TestUtils.Simulate.click(buttons[2])
   expect(actions.onIncrement).toNotHaveBeenCalled()
 })
Esempio n. 29
0
 const simulateMouseOver = (from, to) => {
   Simulate.mouseOut(from, { relatedTarget: to })
   Simulate.mouseOver(to, { relatedTarget: from })
 }
Esempio n. 30
0
export const clickUp = () =>
  Simulate.keyDown(input, { key: 'ArrowUp' });