Skip to content

Commit

Permalink
changes as per comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SriHV committed Jan 9, 2025
1 parent 51becf8 commit 345f49f
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions src/components/char-check-limit/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
Expand All @@ -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();
});
Expand Down

0 comments on commit 345f49f

Please sign in to comment.