Skip to content

Commit b19944a

Browse files
Merge pull request #354 from thejackshelton/add-headless-autocomplete
test(cypress): fixed endless loading tests in autocomplete
2 parents c30ccee + ba2506c commit b19944a

File tree

2 files changed

+87
-101
lines changed

2 files changed

+87
-101
lines changed

packages/kit-headless/src/components/autocomplete/autocomplete.spec.tsx

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -9,89 +9,89 @@ import {
99
AutocompleteOption,
1010
} from './index';
1111

12-
const fruits = [
13-
'Apple',
14-
'Apricot',
15-
'Avocado 🥑',
16-
'Banana',
17-
'Bilberry',
18-
'Blackberry',
19-
'Blackcurrant',
20-
'Blueberry',
21-
'Boysenberry',
22-
'Currant',
23-
'Cherry',
24-
'Coconut',
25-
'Cranberry',
26-
'Cucumber',
27-
'Custard apple',
28-
'Damson',
29-
'Date',
30-
'Dragonfruit',
31-
'Durian',
32-
'Elderberry',
33-
'Feijoa',
34-
'Fig',
35-
'Gooseberry',
36-
'Grape',
37-
'Raisin',
38-
'Grapefruit',
39-
'Guava',
40-
'Honeyberry',
41-
'Huckleberry',
42-
'Jabuticaba',
43-
'Jackfruit',
44-
'Jambul',
45-
'Juniper berry',
46-
'Kiwifruit',
47-
'Kumquat',
48-
'Lemon',
49-
'Lime',
50-
'Loquat',
51-
'Longan',
52-
'Lychee',
53-
'Mango',
54-
'Mangosteen',
55-
'Marionberry',
56-
'Melon',
57-
'Cantaloupe',
58-
'Honeydew',
59-
'Watermelon',
60-
'Miracle fruit',
61-
'Mulberry',
62-
'Nectarine',
63-
'Nance',
64-
'Olive',
65-
'Orange',
66-
'Clementine',
67-
'Mandarine',
68-
'Tangerine',
69-
'Papaya',
70-
'Passionfruit',
71-
'Peach',
72-
'Pear',
73-
'Persimmon',
74-
'Plantain',
75-
'Plum',
76-
'Pineapple',
77-
'Pomegranate',
78-
'Pomelo',
79-
'Quince',
80-
'Raspberry',
81-
'Salmonberry',
82-
'Rambutan',
83-
'Redcurrant',
84-
'Salak',
85-
'Satsuma',
86-
'Soursop',
87-
'Star fruit',
88-
'Strawberry',
89-
'Tamarillo',
90-
'Tamarind',
91-
'Yuzu',
92-
];
93-
9412
const RegularAutocomplete = component$(() => {
13+
const fruits = [
14+
'Apple',
15+
'Apricot',
16+
'Avocado 🥑',
17+
'Banana',
18+
'Bilberry',
19+
'Blackberry',
20+
'Blackcurrant',
21+
'Blueberry',
22+
'Boysenberry',
23+
'Currant',
24+
'Cherry',
25+
'Coconut',
26+
'Cranberry',
27+
'Cucumber',
28+
'Custard apple',
29+
'Damson',
30+
'Date',
31+
'Dragonfruit',
32+
'Durian',
33+
'Elderberry',
34+
'Feijoa',
35+
'Fig',
36+
'Gooseberry',
37+
'Grape',
38+
'Raisin',
39+
'Grapefruit',
40+
'Guava',
41+
'Honeyberry',
42+
'Huckleberry',
43+
'Jabuticaba',
44+
'Jackfruit',
45+
'Jambul',
46+
'Juniper berry',
47+
'Kiwifruit',
48+
'Kumquat',
49+
'Lemon',
50+
'Lime',
51+
'Loquat',
52+
'Longan',
53+
'Lychee',
54+
'Mango',
55+
'Mangosteen',
56+
'Marionberry',
57+
'Melon',
58+
'Cantaloupe',
59+
'Honeydew',
60+
'Watermelon',
61+
'Miracle fruit',
62+
'Mulberry',
63+
'Nectarine',
64+
'Nance',
65+
'Olive',
66+
'Orange',
67+
'Clementine',
68+
'Mandarine',
69+
'Tangerine',
70+
'Papaya',
71+
'Passionfruit',
72+
'Peach',
73+
'Pear',
74+
'Persimmon',
75+
'Plantain',
76+
'Plum',
77+
'Pineapple',
78+
'Pomegranate',
79+
'Pomelo',
80+
'Quince',
81+
'Raspberry',
82+
'Salmonberry',
83+
'Rambutan',
84+
'Redcurrant',
85+
'Salak',
86+
'Satsuma',
87+
'Soursop',
88+
'Star fruit',
89+
'Strawberry',
90+
'Tamarillo',
91+
'Tamarind',
92+
'Yuzu',
93+
];
94+
9595
return (
9696
<>
9797
<AutocompleteRoot style="width: fit-content">

packages/kit-headless/src/components/select/select.spec.tsx

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,28 +74,14 @@ describe('Select', () => {
7474
it('should toggle aria-expanded and the listbox should be hidden', () => {
7575
cy.mount(<ThreeOptionSelect />);
7676

77-
cy.get('button').click().should('have.attr', 'aria-expanded', 'true');
78-
79-
// current passed test for now. doesn't work with click for some reason
8077
cy.get('button')
81-
.focus()
82-
.type('{enter}')
78+
.click()
79+
.should('have.attr', 'aria-expanded', 'true')
80+
.click()
8381
.should('have.attr', 'aria-expanded', 'false');
8482

85-
cy.findByRole('listbox').should('not.exist');
86-
});
87-
88-
it('should use the arrow keys to navigate options', () => {
89-
cy.mount(<ThreeOptionSelect />);
90-
91-
cy.findByTestId('selectTrigger').type('{enter}');
92-
93-
cy.findByRole('listbox').should('be.visible');
94-
95-
cy.findByRole('group').type('{downarrow}');
96-
97-
cy.findByTestId('selectOptionTwo').type('{enter}').should('not.be.visible');
83+
// current passed test for now. doesn't work with click for some reason
9884

99-
cy.findByTestId('selectValue').should('have.text', 'Two');
85+
cy.findByRole('listbox').should('not.exist');
10086
});
10187
});

0 commit comments

Comments
 (0)