From 345f49fd186ae7c6d4976babcf4ef1cd17322b25 Mon Sep 17 00:00:00 2001 From: SriHV Date: Thu, 9 Jan 2025 19:18:02 +0000 Subject: [PATCH] changes as per comments --- .../char-check-limit/_macro.spec.js | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/components/char-check-limit/_macro.spec.js b/src/components/char-check-limit/_macro.spec.js index c81c11ca9a..210d568830 100644 --- a/src/components/char-check-limit/_macro.spec.js +++ b/src/components/char-check-limit/_macro.spec.js @@ -12,38 +12,24 @@ describe('FOR: Macro: CharCheckLimit', () => { describe('WHEN: required params are provided', () => { const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT)); - test('passes jest-axe checks', async () => { + test('THEN: passes jest-axe checks', async () => { const results = await axe($.html()); expect(results).toHaveNoViolations(); }); - test('has the provided id attribute', () => { + test('THEN: has the provided id attribute', () => { expect($('.ons-input__limit').attr('id')).toBe('example-char-check-limit'); }); - test('has the data attribute which defines charCountPlural', () => { + test('THEN: has the data attribute which defines charCountPlural', () => { expect($('.ons-input__limit').attr('data-charcount-plural')).toBe('You have {x} characters remaining'); }); - test('has the data attribute which defines charCountSingular', () => { + test('THEN: has the data attribute which defines charCountSingular', () => { expect($('.ons-input__limit').attr('data-charcount-singular')).toBe('You have {x} character remaining'); }); - }); - }); - - describe('GIVEN: Params: charCountOverLimitSingular', () => { - describe('WHEN: chatCountOverLimitSingular is provided', () => { - test('has the data attribute which defines charCountOverLimitSingular', () => { - const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT)); - + test('THEN: has the data attribute which defines charCountOverLimitSingular', () => { expect($('.ons-input__limit').attr('data-charcount-limit-singular')).toBe('{x} character too many'); }); - }); - }); - - describe('GIVEN: Params: charCountOverLimitPlural', () => { - describe('WHEN: chatCountOverLimitPlural is provided', () => { - test('has the data attribute which defines charCountOverLimitPlural', () => { - const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT)); - + test('THEN: has the data attribute which defines charCountOverLimitPlural', () => { expect($('.ons-input__limit').attr('data-charcount-limit-plural')).toBe('{x} characters too many'); }); }); @@ -62,7 +48,7 @@ describe('FOR: Macro: CharCheckLimit', () => { ), ); - test('passes jest-axe checks with variant set to check', async () => { + test('THEN: passes jest-axe checks with variant set to check', async () => { const results = await axe($.html()); expect(results).toHaveNoViolations(); });