mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #33450 from overleaf/worktree-mg-writefull-spelling-tab
Add writefull language suggestions section to Spelling and language tab GitOrigin-RevId: 6195683ca175a4c3da25a7ab334a605c67db04b8
This commit is contained in:
@@ -40,6 +40,7 @@ function render(props: RenderProps) {
|
||||
items={testData}
|
||||
itemToString={x => String(x?.value)}
|
||||
label={props.label}
|
||||
id={props.id}
|
||||
name="select_control"
|
||||
defaultText={props.defaultText}
|
||||
defaultItem={props.defaultItem}
|
||||
@@ -52,6 +53,7 @@ function render(props: RenderProps) {
|
||||
optionalLabel={props.optionalLabel}
|
||||
loading={props.loading}
|
||||
selectedIcon={props.selectedIcon}
|
||||
portal={props.portal}
|
||||
/>
|
||||
<button type="submit">submit</button>
|
||||
</form>
|
||||
@@ -61,6 +63,38 @@ function render(props: RenderProps) {
|
||||
|
||||
describe('<Select />', function () {
|
||||
describe('initial rendering', function () {
|
||||
it('associates an external label when id is provided', function () {
|
||||
cy.mount(
|
||||
<div style={{ width: '300px' }}>
|
||||
<label htmlFor="external-select">External label</label>
|
||||
<Select
|
||||
id="external-select"
|
||||
items={testData}
|
||||
itemToString={x => String(x?.value)}
|
||||
itemToKey={x => String(x.key)}
|
||||
defaultText="Choose an item"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
cy.findByRole('combobox', { name: 'External label' }).should('exist')
|
||||
})
|
||||
|
||||
it('does not associate an external label when id is not provided', function () {
|
||||
cy.mount(
|
||||
<div style={{ width: '300px' }}>
|
||||
<label htmlFor="external-select">External label</label>
|
||||
<Select
|
||||
items={testData}
|
||||
itemToString={x => String(x?.value)}
|
||||
itemToKey={x => String(x.key)}
|
||||
defaultText="Choose an item"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
cy.findByRole('combobox').should('have.value', 'Choose an item')
|
||||
cy.findByRole('combobox', { name: 'External label' }).should('not.exist')
|
||||
})
|
||||
|
||||
it('renders default text', function () {
|
||||
render({ defaultText: 'Choose an item' })
|
||||
cy.findByTestId('ol-spinner').should('not.exist')
|
||||
@@ -135,6 +169,26 @@ describe('<Select />', function () {
|
||||
cy.findByRole('option', { name: 'Demo item 2 Subtitle 2' })
|
||||
cy.findByRole('option', { name: 'Demo item 3 Subtitle 3' })
|
||||
})
|
||||
|
||||
it('renders dropdown inside a popover when portal is enabled', function () {
|
||||
render({ defaultText: 'Choose an item', portal: true })
|
||||
cy.findByRole('combobox').click()
|
||||
|
||||
cy.get('.select-portal-popover').should('exist')
|
||||
cy.get('.select-portal-popover .select-portal-menu')
|
||||
.should('exist')
|
||||
.and('be.visible')
|
||||
cy.findByRole('option', { name: 'Demo item 1' }).should('exist')
|
||||
})
|
||||
|
||||
it('does not render a popover when portal is disabled', function () {
|
||||
render({ defaultText: 'Choose an item', portal: false })
|
||||
cy.findByRole('combobox').click()
|
||||
|
||||
cy.get('.select-portal-popover').should('not.exist')
|
||||
cy.get('.select-portal-menu').should('not.exist')
|
||||
cy.findByRole('option', { name: 'Demo item 1' }).should('exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('item selection', function () {
|
||||
|
||||
Reference in New Issue
Block a user