Skip to content

Commit 404a70a

Browse files
authored
Merge branch '10.0-release' into alejandro/feat/use-devServer
2 parents 4169bf2 + 857f306 commit 404a70a

7 files changed

+50
-19
lines changed

packages/app/cypress/e2e/specs_list_e2e.cy.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,17 @@ describe('App: Spec List (E2E)', () => {
3232
cy.get('[data-cy="spec-item"]').should('have.length', 1)
3333
.should('contain', 'dom-content.spec.js')
3434

35-
cy.get('button').contains('1 Match')
35+
cy.get('button').contains('1 of 3 Matches')
3636

3737
cy.get('input').clear().type('asdf', { force: true })
3838

3939
cy.get('[data-cy="spec-item"]').should('have.length', 0)
4040

41-
cy.get('button').contains('No Matches')
41+
cy.get('button').contains('0 of 3 Matches')
4242
})
4343

4444
// TODO: find a test project that shows git statuses
45-
it.skip('shows a git status for each spec', () => {
46-
47-
})
45+
it.skip('shows a git status for each spec', () => {})
4846

4947
it('collapses or expands folders when clicked, hiding or revealing the specs within it', () => {
5048
cy.get('[data-cy="spec-item"]').should('contain', 'dom-content.spec.js')

packages/app/src/specs/InlineSpecListHeader.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
for="inline-spec-list-header-search"
4343
class="cursor-text font-light bottom-6px left-24px text-gray-700 select-none absolute"
4444
:class="{
45-
'sr-only': inputFocused
45+
'sr-only': inputFocused || props.search
4646
}"
4747
>
4848
{{ t('specPage.searchPlaceholder') }}

packages/app/src/specs/SpecItem.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
class="icon-light-gray-50 icon-dark-gray-200"
88
/>
99

10-
<div class="text-gray-400 text-indigo-500 group-hocus:text-indigo-500">
10+
<div class="text-gray-400 text-indigo-500 group-hocus:text-indigo-600">
1111
<HighlightedText
1212
:text="fileName"
1313
:indexes="indexes.filter((idx) => idx < fileName.length)"
14-
class="font-medium text-indigo-500 group-hocus:text-indigo-500"
14+
class="font-medium text-indigo-500 group-hocus:text-indigo-600"
1515
highlight-classes="text-gray-1000"
1616
/>
1717
<HighlightedText
1818
:text="extension"
1919
:indexes="indexes.filter((idx) => idx >= fileName.length).map(idx => idx - fileName.length)"
20-
class="font-light group-hocus:text-indigo-500"
20+
class="font-light group-hocus:text-gray-400"
2121
highlight-classes="text-gray-1000"
2222
/>
2323
</div>

packages/app/src/specs/SpecsList.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
v-model="search"
55
class="pb-32px"
66
:result-count="specs.length"
7+
:spec-count="cachedSpecs.length"
78
@show-create-spec-modal="emit('showCreateSpecModal')"
89
@show-spec-pattern-modal="showSpecPatternModal = true"
910
/>
@@ -64,7 +65,7 @@
6465
:file-name="row.data.data?.fileName || row.data.name"
6566
:extension="row.data.data?.specFileExtension || ''"
6667
:indexes="row.data.data?.fileIndexes"
67-
:style="{ paddingLeft: `${((row.data.depth - 2) * 10) + 16 + 22}px` }"
68+
:style="{ paddingLeft: `${((row.data.depth - 2) * 10) + 22}px` }"
6869
/>
6970
</RouterLink>
7071

@@ -73,7 +74,7 @@
7374
:name="row.data.name"
7475
:expanded="treeSpecList[row.index].expanded.value"
7576
:depth="row.data.depth - 2"
76-
:style="{ paddingLeft: `${((row.data.depth - 2) * 10) + 16}px` }"
77+
:style="{ paddingLeft: `${(row.data.depth - 2) * 10}px` }"
7778
:indexes="getDirIndexes(row.data)"
7879
:aria-controls="getIdIfDirectory(row)"
7980
@click="row.data.toggle"

packages/app/src/specs/SpecsListHeader.cy.tsx

+31-6
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,47 @@ describe('<SpecsListHeader />', { keystrokeDelay: 0 }, () => {
6161
.should('have.been.called')
6262
})
6363

64-
it('shows the result count correctly', () => {
65-
const mountWithResultCount = (count = 0) => {
64+
it('shows the count correctly when not searching', () => {
65+
const mountWithSpecCount = (count = 0) => {
6666
cy.mount(() => (<div class="max-w-800px p-12 resize overflow-auto"><SpecsListHeader
6767
modelValue={''}
68-
resultCount={count}
68+
specCount={count}
6969
/></div>))
7070
}
7171

72-
mountWithResultCount(0)
72+
mountWithSpecCount(0)
7373
cy.contains('No Matches')
7474
.should('be.visible')
7575
.and('have.attr', 'aria-live', 'polite')
7676

77-
mountWithResultCount(1)
77+
mountWithSpecCount(1)
7878
cy.contains('1 Match').should('be.visible')
79-
mountWithResultCount(100)
79+
mountWithSpecCount(100)
8080
cy.contains('100 Matches').should('be.visible')
8181
})
82+
83+
it('shows the count correctly while searching', () => {
84+
const mountWithCounts = (resultCount = 0, specCount = 0) => {
85+
cy.mount(() => (<div class="max-w-800px p-12 resize overflow-auto"><SpecsListHeader
86+
modelValue={'foo'}
87+
resultCount={resultCount}
88+
specCount={specCount}
89+
/></div>))
90+
}
91+
92+
mountWithCounts(0, 0)
93+
cy.contains('No Matches')
94+
95+
mountWithCounts(0, 22)
96+
cy.contains('0 of 22 Matches')
97+
98+
mountWithCounts(0, 1)
99+
cy.contains('0 of 1 Match').should('be.visible')
100+
101+
mountWithCounts(1, 1)
102+
cy.contains('1 of 1 Match').should('be.visible')
103+
104+
mountWithCounts(5, 22)
105+
cy.contains('5 of 22 Matches').should('be.visible')
106+
})
82107
})

packages/app/src/specs/SpecsListHeader.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@
1919
<span
2020
class="border-transparent rounded-r flex h-full border-t-1 border-b-1 border-r-1 mr-1px px-16px items-center matches-button group-hocus:bg-indigo-50 group-hocus:border-indigo-300 group-hocus:text-indigo-500"
2121
>
22-
{{ t('components.fileSearch.matchesIndicatorEmptyFileSearch', { count: resultCount, denominator: resultCount}) }}
22+
<span v-if="props.modelValue">
23+
{{ t('components.fileSearch.matchesIndicator', { count: specCount, denominator: specCount, numerator: resultCount}) }}
24+
</span>
25+
<span v-else>
26+
{{ t('components.fileSearch.matchesIndicatorEmptyFileSearch', { count: specCount, denominator: specCount}) }}
27+
</span>
2328
<span class="sr-only">{{ t(`createSpec.viewSpecPatternButton`) }} </span>
2429
</span>
2530
</button>
@@ -53,8 +58,10 @@ const { t } = useI18n()
5358
const props = withDefaults(defineProps<{
5459
modelValue: string
5560
resultCount?: number
61+
specCount?: number
5662
}>(), {
5763
resultCount: 0,
64+
specCount: 0,
5865
})
5966
6067
const emit = defineEmits<{

packages/app/src/specs/SpecsListRowItem.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div
3-
class="h-full outline-none ring-inset grid grid-cols-2 group focus-within:ring-indigo-300 focus-within:ring-1 children:cursor-pointer"
3+
class="h-full outline-none border-gray-50 ring-inset grid grid-cols-2 group focus-within:ring-indigo-300 focus-within:ring-1 children:cursor-pointer"
44
data-cy="specs-list-row"
55
>
66
<div>

0 commit comments

Comments
 (0)