本文整理汇总了TypeScript中test/helper.simulateEscapeKey函数的典型用法代码示例。如果您正苦于以下问题:TypeScript simulateEscapeKey函数的具体用法?TypeScript simulateEscapeKey怎么用?TypeScript simulateEscapeKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了simulateEscapeKey函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('reacts appropriately to the Esc key', function() {
hideOptionList();
simulateKeyDown(toggleButton, 'ArrowDown');
simulateEscapeKey();
assert.equal(optionList.style.display, 'none', 'hides the list');
assert.equal(firstOptionButton.style.backgroundColor, OptionList.INITIAL_OPTION_BUTTON_STYLE['background-color'],
'unselects the selected option');
});
示例2: it
it('works with a thing that has a `hide` method', function() {
var thing = { hide: createSpy() };
hideOnEscapeOrOutsideClick(thing);
document.body.dispatchEvent(new Event('click'));
assert.equal(thing.hide.calls.length, 1, 'calls thingâs hide method when clicking the body');
simulateEscapeKey();
assert.equal(thing.hide.calls.length, 2, 'calls thingâs hide method when pressing the Esc key');
});
示例3: getDatePicker
window.setTimeout(function() {
assert.equal(document.activeElement, domElement, 'when the date picker is closed, the input get focus again');
datePickerButton.click();
document.body.click();
datePicker = getDatePicker();
assert.isNull(datePicker, 'hides the date picker when clicking outside');
datePickerButton.click();
simulateEscapeKey();
datePicker = getDatePicker();
assert.isNull(datePicker, 'hides the date picker when pressing Escape key');
done();
});