Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
selectedItem: (itemIndex: number) =>
`.${Dropdown.slotClassNames.selectedItems} span:nth-child(${itemIndex})`,
}
import { Dropdown } from '@fluentui/react'
const selectors = {
clearIndicator: `.${Dropdown.slotClassNames.clearIndicator}`,
triggerButton: `.${Dropdown.slotClassNames.triggerButton}`,
item: (itemIndex: number) => `.${Dropdown.slotClassNames.itemsList} li:nth-child(${itemIndex})`,
}
const config: ScreenerTestsConfig = {
steps: [
builder =>
builder
.click(selectors.triggerButton)
.click(selectors.item(3))
.snapshot('Selects an item')
.click(selectors.clearIndicator)
.snapshot('Clears the value'),
],
}
export default config
import { Dropdown } from '@fluentui/react'
const selectors = {
triggerButton: `.${Dropdown.slotClassNames.triggerButton}`,
item: (itemIndex: number) => `.${Dropdown.slotClassNames.itemsList} li:nth-child(${itemIndex})`,
}
export const config: ScreenerTestsConfig = {
steps: [
builder =>
builder
.click(selectors.triggerButton)
.snapshot('RTL: Shows list')
.click(selectors.item(3))
.snapshot('RTL: Selects an item'),
],
}
export default config
item: (itemIndex: number) => `.${Dropdown.slotClassNames.itemsList} li:nth-child(${itemIndex})`,
popupTrigger: `.${Button.className}`,
item: (itemIndex: number) => `.${Dropdown.slotClassNames.itemsList} li:nth-child(${itemIndex})`,
}
import { Dropdown } from '@fluentui/react'
const selectors = {
clearIndicator: `.${Dropdown.slotClassNames.clearIndicator}`,
triggerButton: `.${Dropdown.slotClassNames.triggerButton}`,
item: (itemIndex: number) => `.${Dropdown.slotClassNames.itemsList} li:nth-child(${itemIndex})`,
}
const config: ScreenerTestsConfig = {
steps: [
builder =>
builder
.click(selectors.triggerButton)
.click(selectors.item(3))
.snapshot('Selects an item')
.click(selectors.clearIndicator)
.snapshot('Clears the value'),
],
}
import { Dropdown } from '@fluentui/react'
const selectors = {
triggerButton: `.${Dropdown.slotClassNames.triggerButton}`,
item: (itemIndex: number) => `.${Dropdown.slotClassNames.itemsList} li:nth-child(${itemIndex})`,
}
const config: ScreenerTestsConfig = {
themes: ['teams', 'teamsDark', 'teamsHighContrast'],
steps: [
builder => builder.click(selectors.triggerButton).snapshot('Shows list'),
builder =>
builder
.click(selectors.triggerButton)
.click(selectors.item(3))
.snapshot('Selects an item')
.click(selectors.triggerButton)
.snapshot('Opens with selected item highlighted')
.hover(selectors.item(2))
.snapshot('Highlights another item')
item: (itemIndex: number) => `.${Dropdown.slotClassNames.itemsList} li:nth-child(${itemIndex})`,
}
import { Dropdown, DropdownSearchInput } from '@fluentui/react'
const selectors = {
toggleIndicator: `.${Dropdown.slotClassNames.toggleIndicator}`,
input: `.${DropdownSearchInput.slotClassNames.input}`,
item: (itemIndex: number) => `.${Dropdown.slotClassNames.itemsList} li:nth-child(${itemIndex})`,
selectedItem: (itemIndex: number) =>
`.${Dropdown.slotClassNames.selectedItems} span:nth-child(${itemIndex})`,
}
const config: ScreenerTestsConfig = {
themes: ['teams', 'teamsDark', 'teamsHighContrast'],
steps: [
(builder, keys) =>
builder
.click(selectors.toggleIndicator)
.click(selectors.item(2))
.click(selectors.toggleIndicator)
.click(selectors.item(2))
.keys(selectors.input, keys.leftArrow)
import { Dropdown, Button } from '@fluentui/react'
const selectors = {
toggleIndicator: `.${Dropdown.slotClassNames.toggleIndicator}`,
item: (itemIndex: number) => `.${Dropdown.slotClassNames.itemsList} li:nth-child(${itemIndex})`,
popupTrigger: `.${Button.className}`,
}
const config: ScreenerTestsConfig = {
themes: ['teams', 'teamsDark', 'teamsHighContrast'],
steps: [
builder =>
builder
.click(selectors.popupTrigger)
.click(selectors.toggleIndicator)
.hover(selectors.item(2))
.snapshot('Prepares to select item out of popup.')
.click(selectors.item(2))
.snapshot('Item should be selected.'),
],