本文整理匯總了TypeScript中@ephox/agar.Mouse.sHoverOn方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Mouse.sHoverOn方法的具體用法?TypeScript Mouse.sHoverOn怎麽用?TypeScript Mouse.sHoverOn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/agar.Mouse
的用法示例。
在下文中一共展示了Mouse.sHoverOn方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: sAssertFocusOnMenuButton
//.........這裏部分代碼省略.........
sWaitForMenuToAppear(),
sAssertFocusOnToggleItem('Remember me'),
sAssertActiveToggleItemHasOneCheckmark('Remember me'),
Keyboard.sKeydown(doc, Keys.escape(), { }),
sAssertFocusOnMenuButton('Changes'),
sWaitForMenuToDisappear(),
Keyboard.sKeydown(doc, Keys.right(), {}),
sAssertFocusOnMenuButton('Basic Menu Button'),
Keyboard.sKeydown(doc, Keys.space(), { }),
sWaitForMenuToAppear(),
sAssertFocusOnItem('Item1'),
Keyboard.sKeydown(doc, Keys.down(), { }),
sAssertFocusOnItem('Item2'),
Keyboard.sKeydown(doc, Keys.down(), { }),
sAssertFocusOnItem('Nested'),
Keyboard.sKeydown(doc, Keys.right(), { }),
sAssertFocusOnItem('Nested menu x 2'),
Keyboard.sKeydown(doc, Keys.right(), { }),
sAssertFocusOnItem('Nested menu x 3'),
Keyboard.sKeydown(doc, Keys.left(), { }),
sAssertFocusOnItem('Nested menu x 2'),
Keyboard.sKeydown(doc, Keys.escape(), { }),
sAssertFocusOnItem('Nested'),
Keyboard.sKeydown(doc, Keys.escape(), { }),
sAssertFocusOnMenuButton('Basic Menu Button'),
sWaitForMenuToDisappear(),
Keyboard.sKeydown(doc, Keys.enter(), { }),
sWaitForMenuToAppear(),
sAssertFocusOnItem('Item1'),
Keyboard.sKeydown(doc, Keys.up(), { }),
sAssertFocusOnItem('Nested'),
Keyboard.sKeydown(doc, Keys.enter(), { }),
sAssertFocusOnItem('Nested menu x 2'),
Keyboard.sKeydown(doc, Keys.escape(), { }),
sAssertFocusOnItem('Nested'),
Keyboard.sKeydown(doc, Keys.up(), { }),
Keyboard.sKeydown(doc, Keys.enter(), { }),
Logger.t(
'Pressing <enter> on an item without a submenu should trigger it and close the menu',
GeneralSteps.sequence([
sWaitForMenuToDisappear(),
store.sAssertEq('Store should have evidence of item triggered', [ 'menuitem-2 action' ])
])
),
store.sClear,
Step.sync(() => {
SilverMenubar.focus(menubar);
}),
sAssertFocusOnMenuButton('Changes'),
Keyboard.sKeydown(doc, Keys.escape(), { }),
store.sAssertEq('Pressing escape in menubar should fire event', [ 'Menubar.escape' ]),
Log.stepsAsStep('TBA', 'AP-307: Once a menu is expanded, hovering on buttons should switch which menu is expanded', [
Mouse.sHoverOn(menubar.element(), 'button[role="menuitem"]:contains("Basic Menu Button")'),
Step.wait(100),
UiFinder.sNotExists(sink, '[role="menu"]'),
Mouse.sClickOn(menubar.element(), 'button[role="menuitem"]:contains("Changes")'),
UiFinder.sWaitForVisible(
'Waiting for changes menu',
sink,
'.tox-collection__item:contains("Remember me")'
),
sAssertMenuItemGroups('After clicking on "Changes"', [
[ 'Remember me' ]
]),
Mouse.sHoverOn(menubar.element(), 'button[role="menuitem"]:contains("Basic Menu Button")'),
UiFinder.sWaitForVisible(
'Waiting for basic menu',
sink,
'.tox-collection__item:contains("Item1")'
),
// Focus the menu item, not the toolbar item
Keyboard.sKeydown(doc, Keys.down(), { }),
UiFinder.sWaitForVisible(
'Wait for basic menu to get selected class',
sink,
'.tox-selected-menu .tox-collection__item:contains("Item1")'
),
// This is failing because tox-selected-menu is not set.
sAssertMenuItemGroups('After hovering on Basic (after another menu was open)', [
[ 'Item1' ],
[ 'Item2', 'Nested menu>' ]
])
])
];
}, () => {
示例2: cFindNthIn
//.........這裏部分代碼省略.........
]
});
})
)
]),
FocusTools.sTryOnSelector('Focus should be on A', doc, '.tox-collection__item:contains(A).tox-collection__item--active'),
Keyboard.sKeydown(doc, Keys.down(), { }),
FocusTools.sTryOnSelector('Focus should be on B', doc, '.tox-collection__item:contains(B)'),
Keyboard.sKeydown(doc, Keys.down(), { }),
FocusTools.sTryOnSelector('Focus should be on C', doc, '.tox-collection__item:contains(C)'),
])
),
// NOTE: We need a layout engine to use flex-wrap navigation.
navigator.userAgent.indexOf('PhantomJS') > -1 ?
FocusTools.sSetFocus('Force focus to F on phantom', Body.body(), '.tox-collection__item:contains("F")')
: Logger.t(
'Checking the second collection: columns = auto',
GeneralSteps.sequence([
Chain.asStep(Body.body(), [
cFindNthIn('[role="dialog"] .tox-form__group .tox-collection', 1),
Assertions.cAssertStructure(
'Checking structure',
ApproxStructure.build((s, str, arr) => {
return s.element('div', {
classes: [ arr.has('tox-collection'), arr.has('tox-collection--grid'), arr.not('tox-menu') ],
children: [
s.element('div', {
classes: [ arr.has('tox-collection__group') ],
children: Arr.map([ 'D', 'E', 'F' ], (letter) =>
structureItem(Option.none(), Option.some('icon-' + letter))(s, str, arr)
)
})
]
});
})
)
]),
FocusTools.sTryOnSelector('Focus should be on C', doc, '.tox-collection__item:contains(C)'),
Keyboard.sKeydown(doc, Keys.tab(), { }),
FocusTools.sTryOnSelector('Focus should be on D', doc, '.tox-collection__item:contains(D)'),
Keyboard.sKeydown(doc, Keys.right(), { }),
FocusTools.sTryOnSelector('Focus should be on E', doc, '.tox-collection__item:contains(E)'),
Keyboard.sKeydown(doc, Keys.right(), { }),
FocusTools.sTryOnSelector('Focus should be on F', doc, '.tox-collection__item:contains(F)'),
])
),
Logger.t(
'Checking the third collection: columns = 2',
GeneralSteps.sequence([
Chain.asStep(Body.body(), [
cFindNthIn('[role="dialog"] .tox-form__group .tox-collection', 2),
Assertions.cAssertStructure(
'Checking structure',
ApproxStructure.build((s, str, arr) => {
return s.element('div', {
classes: [ arr.has('tox-collection'), arr.has('tox-collection--grid'), arr.not('tox-menu') ],
children: [
s.element('div', {
classes: [ arr.has('tox-collection__group') ],
children: Arr.map([ 'G', 'H' ], (letter) =>
structureItem(Option.none(), Option.some('icon-' + letter))(s, str, arr)
)
}),
s.element('div', {
classes: [ arr.has('tox-collection__group') ],
children: Arr.map([ 'I' ], (letter) =>
structureItem(Option.none(), Option.some('icon-' + letter))(s, str, arr)
)
})
]
});
})
)
]),
FocusTools.sTryOnSelector('Focus should be on F', doc, '.tox-collection__item:contains(F)'),
Keyboard.sKeydown(doc, Keys.tab(), { }),
FocusTools.sTryOnSelector('Focus should be on G', doc, '.tox-collection__item:contains(G)'),
Keyboard.sKeydown(doc, Keys.right(), { }),
FocusTools.sTryOnSelector('Focus should be on H', doc, '.tox-collection__item:contains(H)'),
Keyboard.sKeydown(doc, Keys.down(), { }),
FocusTools.sTryOnSelector('Focus should be on I', doc, '.tox-collection__item:contains(I)'),
])
),
Log.stepsAsStep('TBA', 'Check focus follows mouse also', [
Mouse.sHoverOn(Body.body(), '.tox-collection__item:contains(G)'),
Chain.asStep(Body.body(), [
UiFinder.cFindIn('.tox-collection__item--active'),
Chain.op((activeElem) => {
const value = Attr.get(activeElem, 'data-collection-item-value');
Assertions.assertEq('Checking selected value', 'g', value);
})
])
]),
TestHelpers.GuiSetup.mRemoveStyles
]
), onSuccess, onFailure);
},