Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sort the frameworks select dropdown in a more logical way #21553

Merged
merged 2 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions packages/launchpad/src/setup/EnvironmentSetup.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ describe('<EnvironmentSetup />', { viewportWidth: 800 }, () => {
.click()
.should('have.attr', 'aria-expanded', 'true')

cy.get('li')
.then(($items) => {
return $items.map((_idx, html) => Cypress.$(html).text()).get()
})
// alphabetical order
// we should "support is in alpha" for a11y (not shown visually)
.should('deep.eq', ['Create React App (v5) Support is in Alpha', 'Vue.js (v3)'])

const frameworkIconName = (frameworkName: string) => {
if (frameworkName.includes('React')) {
return 'react-logo'
Expand Down
11 changes: 2 additions & 9 deletions packages/launchpad/src/setup/EnvironmentSetup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
} from '../generated/graphql'

import { useI18n } from '@cy/i18n'
import { sortBy } from 'lodash'
import { useMutation } from '@urql/vue'

gql`
Expand Down Expand Up @@ -93,18 +92,12 @@ const { t } = useI18n()

const bundlers = computed(() => {
const all = props.gql.framework?.supportedBundlers || []
const _bundlers = all.map((b) => {
return {
disabled: all.length <= 1,
...b,
}
})

return _bundlers
return all.map((b) => ({ disabled: all.length <= 1, ...b })).sort((x, y) => x.name.localeCompare(y.name))
})

const frameworks = computed(() => {
return sortBy((props.gql.frameworks ?? []).map((f) => ({ ...f })), 'category')
return (props.gql.frameworks || []).map((x) => ({ ...x })).sort((x, y) => x.name.localeCompare(y.name))
})

gql`
Expand Down