Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0d44c48
WDS-125 add options storing in model for remote searching
Ctepan Jan 31, 2023
50d3d1b
Merge branch 'feat/WDS-125-search-in-select' into feat/WDS-125-async-…
Ctepan Feb 1, 2023
38671f8
Merge branch 'feat/WDS-125-search-in-select' into feat/WDS-125-async-…
Ctepan Feb 1, 2023
0c23ddd
WDS-125 add features to STextField to prepare for select with search
Ctepan Feb 3, 2023
d778e53
WDS-125 add options storing for single select
Ctepan Feb 3, 2023
64119cc
WDS-125 refactor: move dropdown search prop to scoped slot from SSele…
Ctepan Feb 3, 2023
b76e303
WDS-125 fix text field input font
Ctepan Feb 3, 2023
e42be28
WDS-125 fix prefix overflow in text field
Ctepan Feb 3, 2023
5474938
WDS-125 fix text overflow and icon shrink in select option
Ctepan Feb 3, 2023
bdbc107
WDS-125 remove passiveAppend prop
Ctepan Feb 6, 2023
c4516b0
WDS-125 fix text field input width in wide container
Ctepan Feb 13, 2023
44be614
WDS-125 use right icons in select chevron and add switch between 16/2…
Ctepan Feb 13, 2023
a8059af
WDS-125 fix changesets format
Ctepan Feb 13, 2023
ba5fac0
WDS-125 refactor options search
Ctepan Feb 13, 2023
596bade
WDS-125 add trigger search
Ctepan Feb 13, 2023
5f92edb
WDS-125 remove wrong blur condition in select dropdown
Ctepan Feb 14, 2023
a1b9bb6
WDS-125 hide selection buttons in select menu from focus by tab key
Ctepan Feb 14, 2023
8b88902
WDS-125 make popover update position on trigger size change
Ctepan Feb 14, 2023
e559175
WDS-125 use correct trigger ref for resize observer in SPopover
Ctepan Feb 14, 2023
335cd50
WDS-125 fix formatting
Ctepan Feb 14, 2023
8ed1d1c
Merge branch 'next' into feat/WDS-125-async-select-search
Ctepan Feb 14, 2023
b297035
WDS-125 refactor comments
Ctepan Feb 15, 2023
338204c
WDS-125 add missing change description
Ctepan Feb 15, 2023
d4d3018
WDS-125 add tests for new features
Ctepan Feb 15, 2023
fdfa953
WDS-125 fix lint
Ctepan Feb 15, 2023
e5673de
Merge branch 'next' into feat/WDS-125-async-select-search
Ctepan Feb 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/nine-vans-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@soramitsu-ui/ui': minor
---

**feat**(`STextField`): add `prefix` slot to render inline elements before input, and `filled-state` prop to manually activate the filled state on the component when the prefix presents

5 changes: 5 additions & 0 deletions .changeset/real-radios-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': minor
---

**feat**(`SSelect`, `SDropdown`): introduce `empty` slot; it is forwarded to the underlying `SSelectDropdown` component
5 changes: 5 additions & 0 deletions .changeset/sixty-pants-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': patch
---

**fix**(`STextField`): specify input font (`sora-tpg-p3`)
5 changes: 5 additions & 0 deletions .changeset/sweet-baboons-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': minor
---

**feat**(`SSelect`, `SDropdown`): add `remote-search` prop that disables default search behaviour
5 changes: 5 additions & 0 deletions .changeset/wild-timers-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': minor
---

**feat**(`SSelect`): add `triggerSearch` prop to enable search input in select input
141 changes: 140 additions & 1 deletion packages/ui/cypress/component/Select.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { VueTestUtils } from 'cypress/vue'
import { SSelect, SSelectBase, SSelectButton, SSelectInput, SDropdown, SelectSize, STextField } from '@/lib'
import {
SSelect,
SSelectBase,
SSelectButton,
SSelectInput,
SDropdown,
SelectSize,
STextField,
SelectOptionType,
} from '@/lib'

const SIZES = [SelectSize.Sm, SelectSize.Md, SelectSize.Lg, SelectSize.Xl]

Expand All @@ -14,6 +23,7 @@ after(() => {
})

const findBtnLabel = () => cy.get('.s-select-btn__label')
const testidSelector = (id: string) => `[data-testid=${id}]`

it('Gallery - Dropdown', () => {
cy.mount({
Expand Down Expand Up @@ -407,3 +417,132 @@ it('SSelectDropdown overlaps STextField', () => {
// trying to click to ensure the element is not covered by anything
.click()
})
;['SSelect', 'SDropdown'].forEach((selectVariantName) => {
it(`${selectVariantName} - 'empty' slot works`, () => {
cy.mount({
setup() {
return {
options: [],
selectVariantName,
}
},
template: `
<component :is="selectVariantName" v-bind="{ options }">
<template #empty>
<div>I'm empty</div>
</template>
</component>
`,
})

cy.get(testidSelector('select-trigger')).click()
cy.contains("I'm empty").should('exist')
})

it(`${selectVariantName} - it is possible to set option type`, () => {
cy.mount({
setup() {
return {
options: [{ label: 'label', value: 'value' }],
selectVariantName,
selectOptionTypes: Object.values(SelectOptionType),
selectOptionType: ref(),
}
},
template: `
<select id="options-type" v-model="selectOptionType">
<option v-for="type in selectOptionTypes" :value="type" />
</select>

<component :is="selectVariantName" v-bind="{ options }" model-value="value" :option-type="selectOptionType"/>
`,
})

cy.get('select#options-type').select(SelectOptionType.Default)
cy.get(testidSelector('select-trigger')).click()
cy.get(testidSelector('select-option-checkmark')).should('exist')

cy.get('select#options-type').select(SelectOptionType.Radio)
cy.get(testidSelector('select-trigger')).click()
cy.get(testidSelector('select-option-radio')).should('exist')

cy.get('select#options-type').select(SelectOptionType.Checkbox)
cy.get(testidSelector('select-trigger')).click()
cy.get(testidSelector('select-option-checkbox')).should('exist')
})

it(`${selectVariantName} - there are dropdown search that allows filter options by labels`, () => {
cy.mount({
setup() {
return {
options: [
{ label: 'label11', value: 'value1' },
{ label: 'label112', value: 'value2' },
{ label: 'label133', value: 'value3' },
{ label: 'label13', value: 'value4' },
],
model: ref('value1'),
selectVariantName,
}
},
template: `
<component :is="selectVariantName" v-bind="{ options }" model-value="value" dropdown-search />
`,
})

const SEARCH_QUERY = 'label11'
const OPTIONS_WITH_SEARCH_QUERY_IN_LABEL = 2

cy.get(testidSelector('select-trigger')).click()
cy.get(testidSelector('select-dropdown-search')).type(SEARCH_QUERY)
cy.get(testidSelector('select-option')).should('have.length', OPTIONS_WITH_SEARCH_QUERY_IN_LABEL)
})
})

it(`SSelect - there are trigger search that allows filter options by labels`, () => {
cy.mount({
setup() {
return {
options: [
{ label: 'label11', value: 'value1' },
{ label: 'label112', value: 'value2' },
{ label: 'label133', value: 'value3' },
{ label: 'label13', value: 'value4' },
],
model: ref('value1'),
}
},
template: `
<SSelect v-bind="{ options }" trigger-search />
`,
})

const SEARCH_QUERY = 'label11'
const OPTIONS_WITH_SEARCH_QUERY_IN_LABEL = 2

cy.get(testidSelector('select-trigger')).click()
cy.get(testidSelector('select-trigger')).type(SEARCH_QUERY)
cy.get(testidSelector('select-option')).should('have.length', OPTIONS_WITH_SEARCH_QUERY_IN_LABEL)
})

it(`SSelect - popup is same width as trigger`, () => {
cy.mount({
setup() {
return {
options: [{ label: 'label11', value: 'value1' }],
model: ref('value1'),
}
},
template: `
<SSelect v-bind="{ options }" />
`,
})

cy.get(testidSelector('select-trigger')).click()

cy.get(testidSelector('select-trigger')).then(($el1) => {
cy.get(testidSelector('select-dropdown')).should(($el2) => {
expect($el2).to.have.css('width', $el1.outerWidth() + 'px')
})
})
})
Loading