Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
expect(called).toBe(true);
unmount();
// callback returns Promise(resolve)
called = false;
let cbPromise = () => {
return new Promise((resolve) => {
called = true;
setTimeout(resolve, 2000);
});
};
close = modal({
[key]: cbPromise
});
expect(called).toBe(false);
Simulate.click(document.querySelector(btnSelector));
jest.runOnlyPendingTimers();
expect(called).toBe(true);
unmount();
// callback with args that returns Promise
called = false;
const cbPromiseWithArg = (closeFn) => {
expect(document.querySelector(btnSelector).classList.contains('zent-btn-loading')).toBe(false);
return new Promise((resolve) => {
setTimeout(() => {
called = true;
closeFn(); // close manually
expect(document.querySelector(btnSelector).classList.contains('zent-btn-loading')).toBe(true);
resolve();
}, 2000);
beforeEach(() => {
control = scryRenderedDOMComponentsWithClass(cmp, 'clicky-mcduck')[0];
Simulate.click(control, {});
popover = document.querySelectorAll('.popover')[1] // it clones the original;
wrapper = document.querySelectorAll('.popover-wrapper')[0];
});
it(`has the appropriate nubbin classname`, () => {
it('should use rowClick to expand', () => {
const clickRow = node.find('tbody tr:first');
Simulate.click(clickRow[0]);
expect(clickRow.next().text()).to.be('123');
});
});
it('should handle Cancel', () => {
instance = renderIntoDocument(
);
const push = spy();
instance.context.router = { push };
const btnCancel = findRenderedDOMComponentWithClass(instance, 'btn__cancel');
Simulate.click(btnCancel);
push.should.be.calledWith('/AccountProfile');
});
});
it('can set optionFilterProp', () => {
const select = ReactDOM.render(
<select style="{{">
<option label="一" value="1">1</option>
<option label="二" value="2">2</option>
<option label="十一" value="11">11</option>
</select>, div);
ReactDOM.findDOMNode(select.refs.selection).focus();
Simulate.click(ReactDOM.findDOMNode(select.refs.selection));
select.getInputDOMNode().value = 1;
Simulate.change(select.getInputDOMNode());
expect($(select.getPopupDOMNode()).find('.rc-select-dropdown-menu-item').length).toBe(0);
select.getInputDOMNode().value = 2;
Simulate.change(select.getInputDOMNode());
expect($(select.getPopupDOMNode()).find('.rc-select-dropdown-menu-item').length).toBe(0);
select.getInputDOMNode().value = '一';
Simulate.change(select.getInputDOMNode());
expect($(select.getPopupDOMNode()).find('.rc-select-dropdown-menu-item').length).toBe(2);
select.getInputDOMNode().value = '二';
Simulate.change(select.getInputDOMNode());
expect($(select.getPopupDOMNode()).find('.rc-select-dropdown-menu-item').length).toBe(1);
});
});
export function closeLock(lock) {
const node = q(lock, ".auth0-lock-close-button");
if (!node) {
throw new Error("Unable to close the Lock: couldn't find the close button");
}
Simulate.click(node, {});
if (isOpened(lock)) {
throw new Error("Unable to close the Lock: clicking the close button didn't work");
}
}
props.updateError = spy();
const push = spy();
instance = renderIntoDocument();
scryRenderedComponentsWithType(instance, TransactionPopup).length.should.equal(0);
instance.context.router = { push };
const transactBtnComponent = findRenderedComponentWithType(instance, TransactBtn);
const transactBtn = findRenderedDOMComponentWithClass(transactBtnComponent, 'btn__transact');
Simulate.click(transactBtn);
const transactionPopup = findRenderedComponentWithType(instance, TransactionPopup);
const okBtn = findRenderedDOMComponentWithClass(transactionPopup, 'btn__ok');
const passwordInput = findRenderedDOMComponentWithClass(transactionPopup, 'password');
const expirationInput = findRenderedDOMComponentWithClass(transactionPopup, 'expiration');
Simulate.click(okBtn);
props.updateError.should.be.calledWith('Password Required');
expirationInput.value='1';
ReactTestUtils.Simulate.change(expirationInput);
passwordInput.value = 'secret';
Simulate.change(passwordInput);
Simulate.click(okBtn);
props.postTransaction.should.be.calledWith({
db_author: 'Sandy',
cr_author: '',
db_latlng: '0,0',
expiration_time: 1,
transaction_item: [{
key: 0,
name: 'item1',
it('calls onSelectItem', () => {
const onSelectItem = jasmine.createSpy('onSelectItem');
const list = makeList(['1', '2'], {onSelectItem});
const item = scryRenderedDOMComponentsWithClass(list, 'editable-item')[0];
Simulate.click(item);
expect(onSelectItem).toHaveBeenCalledWith('1', 0);
});
});
it(`hides the div`, () => {
let toggleable = document.querySelector('#myDiv');
expect(toggleable.className).to.contain('show');
Simulate.click(control, {});
expect(toggleable.className).to.contain('hide');
});
});
beforeEach(() => {
Simulate.click(tabs[1])
})