Skip to content

Commit 65dd166

Browse files
committed
Restoring tests
1 parent 1d0c191 commit 65dd166

File tree

2 files changed

+0
-172
lines changed

2 files changed

+0
-172
lines changed

core/src/components/input/test/input.spec.ts

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -133,89 +133,3 @@ describe('input: clear icon', () => {
133133
expect(icon.getAttribute('icon')).toBe('foo');
134134
});
135135
});
136-
137-
// Regression tests for screen reader accessibility of error messages
138-
describe('input: error text accessibility', () => {
139-
it('should have error text element with proper structure', async () => {
140-
const page = await newSpecPage({
141-
components: [Input],
142-
html: `<ion-input label="Input" error-text="This field is required"></ion-input>`,
143-
});
144-
145-
const errorTextEl = page.body.querySelector('ion-input .error-text');
146-
expect(errorTextEl).not.toBe(null);
147-
expect(errorTextEl!.getAttribute('id')).toContain('error-text');
148-
expect(errorTextEl!.textContent).toBe('This field is required');
149-
});
150-
151-
it('should set aria-invalid when input is invalid', async () => {
152-
const page = await newSpecPage({
153-
components: [Input],
154-
html: `<ion-input label="Input" error-text="Required field" class="ion-touched ion-invalid"></ion-input>`,
155-
});
156-
157-
const nativeInput = page.body.querySelector('ion-input input')!;
158-
159-
// Should be invalid because of the classes
160-
expect(nativeInput.getAttribute('aria-invalid')).toBe('true');
161-
});
162-
163-
it('should set aria-describedby to error text when invalid', async () => {
164-
const page = await newSpecPage({
165-
components: [Input],
166-
html: `<ion-input label="Input" error-text="Required field" class="ion-touched ion-invalid"></ion-input>`,
167-
});
168-
169-
const nativeInput = page.body.querySelector('ion-input input')!;
170-
const errorTextEl = page.body.querySelector('ion-input .error-text')!;
171-
172-
// Verify aria-describedby points to error text
173-
const errorId = errorTextEl.getAttribute('id');
174-
expect(nativeInput.getAttribute('aria-describedby')).toBe(errorId);
175-
});
176-
177-
it('should set aria-describedby to helper text when valid', async () => {
178-
const page = await newSpecPage({
179-
components: [Input],
180-
html: `<ion-input label="Input" helper-text="Enter a value" error-text="Required field"></ion-input>`,
181-
});
182-
183-
const nativeInput = page.body.querySelector('ion-input input')!;
184-
const helperTextEl = page.body.querySelector('ion-input .helper-text')!;
185-
186-
// When not invalid, should point to helper text
187-
const helperId = helperTextEl.getAttribute('id');
188-
expect(nativeInput.getAttribute('aria-describedby')).toBe(helperId);
189-
expect(nativeInput.getAttribute('aria-invalid')).toBeNull();
190-
});
191-
192-
it('should have helper text element with proper structure', async () => {
193-
const page = await newSpecPage({
194-
components: [Input],
195-
html: `<ion-input label="Input" helper-text="Enter a valid value"></ion-input>`,
196-
});
197-
198-
const helperTextEl = page.body.querySelector('ion-input .helper-text');
199-
expect(helperTextEl).not.toBe(null);
200-
expect(helperTextEl!.getAttribute('id')).toContain('helper-text');
201-
expect(helperTextEl!.textContent).toBe('Enter a valid value');
202-
});
203-
204-
it('should maintain error text content when error text changes dynamically', async () => {
205-
const page = await newSpecPage({
206-
components: [Input],
207-
html: `<ion-input label="Input"></ion-input>`,
208-
});
209-
210-
const input = page.body.querySelector('ion-input')!;
211-
212-
// Add error text dynamically
213-
input.setAttribute('error-text', 'Invalid email format');
214-
await page.waitForChanges();
215-
216-
const errorTextEl = page.body.querySelector('ion-input .error-text');
217-
expect(errorTextEl).not.toBe(null);
218-
expect(errorTextEl!.getAttribute('id')).toContain('error-text');
219-
expect(errorTextEl!.textContent).toBe('Invalid email format');
220-
});
221-
});

core/src/components/textarea/test/textarea.spec.ts

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -85,89 +85,3 @@ describe('textarea: label rendering', () => {
8585
expect(labelText.textContent).toBe('Label Prop Text');
8686
});
8787
});
88-
89-
// Accessibility tests for error text announcements to screen readers
90-
describe('textarea: error text accessibility', () => {
91-
it('should have error text element with proper structure', async () => {
92-
const page = await newSpecPage({
93-
components: [Textarea],
94-
html: `<ion-textarea label="Textarea" error-text="This field is required"></ion-textarea>`,
95-
});
96-
97-
const errorTextEl = page.body.querySelector('ion-textarea .error-text');
98-
expect(errorTextEl).not.toBe(null);
99-
expect(errorTextEl!.getAttribute('id')).toContain('error-text');
100-
expect(errorTextEl!.textContent).toBe('This field is required');
101-
});
102-
103-
it('should set aria-invalid when textarea is invalid', async () => {
104-
const page = await newSpecPage({
105-
components: [Textarea],
106-
html: `<ion-textarea label="Textarea" error-text="Required field" class="ion-touched ion-invalid"></ion-textarea>`,
107-
});
108-
109-
const nativeTextarea = page.body.querySelector('ion-textarea textarea')!;
110-
111-
// Should be invalid because of the classes
112-
expect(nativeTextarea.getAttribute('aria-invalid')).toBe('true');
113-
});
114-
115-
it('should set aria-describedby to error text when invalid', async () => {
116-
const page = await newSpecPage({
117-
components: [Textarea],
118-
html: `<ion-textarea label="Textarea" error-text="Required field" class="ion-touched ion-invalid"></ion-textarea>`,
119-
});
120-
121-
const nativeTextarea = page.body.querySelector('ion-textarea textarea')!;
122-
const errorTextEl = page.body.querySelector('ion-textarea .error-text')!;
123-
124-
// Verify aria-describedby points to error text
125-
const errorId = errorTextEl.getAttribute('id');
126-
expect(nativeTextarea.getAttribute('aria-describedby')).toBe(errorId);
127-
});
128-
129-
it('should set aria-describedby to helper text when valid', async () => {
130-
const page = await newSpecPage({
131-
components: [Textarea],
132-
html: `<ion-textarea label="Textarea" helper-text="Enter comments" error-text="Required field"></ion-textarea>`,
133-
});
134-
135-
const nativeTextarea = page.body.querySelector('ion-textarea textarea')!;
136-
const helperTextEl = page.body.querySelector('ion-textarea .helper-text')!;
137-
138-
// When not invalid, should point to helper text
139-
const helperId = helperTextEl.getAttribute('id');
140-
expect(nativeTextarea.getAttribute('aria-describedby')).toBe(helperId);
141-
expect(nativeTextarea.getAttribute('aria-invalid')).toBeNull();
142-
});
143-
144-
it('should have helper text element with proper structure', async () => {
145-
const page = await newSpecPage({
146-
components: [Textarea],
147-
html: `<ion-textarea label="Textarea" helper-text="Enter your comments"></ion-textarea>`,
148-
});
149-
150-
const helperTextEl = page.body.querySelector('ion-textarea .helper-text');
151-
expect(helperTextEl).not.toBe(null);
152-
expect(helperTextEl!.getAttribute('id')).toContain('helper-text');
153-
expect(helperTextEl!.textContent).toBe('Enter your comments');
154-
});
155-
156-
it('should maintain error text content when error text changes dynamically', async () => {
157-
const page = await newSpecPage({
158-
components: [Textarea],
159-
html: `<ion-textarea label="Textarea"></ion-textarea>`,
160-
});
161-
162-
const textarea = page.body.querySelector('ion-textarea')!;
163-
164-
// Add error text dynamically
165-
textarea.setAttribute('error-text', 'Invalid content');
166-
await page.waitForChanges();
167-
168-
const errorTextEl = page.body.querySelector('ion-textarea .error-text');
169-
expect(errorTextEl).not.toBe(null);
170-
expect(errorTextEl!.getAttribute('id')).toContain('error-text');
171-
expect(errorTextEl!.textContent).toBe('Invalid content');
172-
});
173-
});

0 commit comments

Comments
 (0)