Skip to content

Commit

Permalink
remove quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
precious-onyenaucheya-ons committed Sep 13, 2024
1 parent b19fc31 commit 41a858d
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/components/card/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH,
} from './_test-examples';

describe('macro: card', () => {
describe('FOR: card', () => {
describe('mode: without image', () => {
it('passes jest-axe checks', async () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITHOUT_IMAGE));
Expand All @@ -20,7 +20,7 @@ describe('macro: card', () => {
expect(results).toHaveNoViolations();
});

it('has the provided `title` text', () => {
it('has the provided title text', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITHOUT_IMAGE));

expect($('.ons-card__title').text().trim()).toBe('Example card title');
Expand All @@ -29,7 +29,7 @@ describe('macro: card', () => {
it.each([
[1, 'h1'],
[4, 'h4'],
])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => {
])('has the correct element type for the provided headingLevel (%i -> %s)', (headingLevel, expectedTitleTag) => {
const $ = cheerio.load(
renderComponent('card', {
...EXAMPLE_CARD_WITHOUT_IMAGE,
Expand All @@ -40,13 +40,13 @@ describe('macro: card', () => {
expect($(`${expectedTitleTag}.ons-card__title`).text().trim()).toBe('Example card title');
});

it('has the provided `text` accessible via the `textId` identifier', () => {
it('has the provided text accessible via the textId identifier', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITHOUT_IMAGE));

expect($('#example-text-id').text().trim()).toBe('Example card text.');
});

it('renders the provided `itemsList` using the `list` component', () => {
it('renders the provided itemsList using the list component', () => {
const faker = templateFaker();
const listsSpy = faker.spy('list');

Expand All @@ -61,7 +61,7 @@ describe('macro: card', () => {
});
});

it('outputs a hyperlink with the provided `url`', () => {
it('outputs a hyperlink with the provided url', () => {
const $ = cheerio.load(
renderComponent('card', {
...EXAMPLE_CARD_WITHOUT_IMAGE,
Expand All @@ -81,7 +81,7 @@ describe('macro: card', () => {
expect(results).toHaveNoViolations();
});

it('has the provided `title` text', () => {
it('has the provided title text', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));

expect($('.ons-card__title').text().trim()).toBe('Example card title');
Expand All @@ -90,7 +90,7 @@ describe('macro: card', () => {
it.each([
[1, 'h1'],
[4, 'h4'],
])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => {
])('has the correct element type for the provided headingLevel (%i -> %s)', (headingLevel, expectedTitleTag) => {
const $ = cheerio.load(
renderComponent('card', {
...EXAMPLE_CARD_WITH_IMAGE,
Expand All @@ -101,7 +101,7 @@ describe('macro: card', () => {
expect($(`${expectedTitleTag}.ons-card__title`).text().trim()).toBe('Example card title');
});

it('has the provided `text`', () => {
it('has the provided text', () => {
const $ = cheerio.load(
renderComponent('card', {
...EXAMPLE_CARD_WITH_IMAGE,
Expand All @@ -111,7 +111,7 @@ describe('macro: card', () => {
expect($('#example-text-id').text().trim()).toBe('Example card text.');
});

it('outputs a hyperlink with the provided `url`', () => {
it('outputs a hyperlink with the provided url', () => {
const $ = cheerio.load(
renderComponent('card', {
...EXAMPLE_CARD_WITH_IMAGE,
Expand All @@ -123,25 +123,25 @@ describe('macro: card', () => {
});

describe('with a custom image', () => {
it('outputs an `img` element', () => {
it('outputs an img element', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));

expect($('.ons-card__image')[0].tagName).toBe('img');
});

it('outputs an `img` element with the expected `srcset`', () => {
it('outputs an img element with the expected srcset', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));

expect($('.ons-card__image').attr('srcset')).toBe('example-small.png 1x, example-large.png 2x');
});

it('outputs an `img` element with the expected `src`', () => {
it('outputs an img element with the expected src', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));

expect($('.ons-card__image').attr('src')).toBe('example-small.png');
});

it('outputs an `img` element with the expected alt text', () => {
it('outputs an img element with the expected alt text', () => {
const $ = cheerio.load(
renderComponent('card', {
...EXAMPLE_CARD_WITH_IMAGE,
Expand All @@ -154,53 +154,53 @@ describe('macro: card', () => {
});

describe('with a default placeholder image', () => {
it('outputs an `img` element', () => {
it('outputs an img element', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE));

expect($('.ons-card__image')[0].tagName).toBe('img');
});

it('outputs an `img` element with the expected `srcset`', () => {
it('outputs an img element with the expected srcset', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE));

expect($('.ons-card__image').attr('srcset')).toBe('/img/small/placeholder-card.png 1x, /img/large/placeholder-card.png 2x');
});

it('outputs an `img` element with the expected `src`', () => {
it('outputs an img element with the expected src', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE));

expect($('.ons-card__image').attr('src')).toBe('/img/small/placeholder-card.png');
});

it('outputs an `img` element with the expected empty alt text', () => {
it('outputs an img element with the expected empty alt text', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE));

expect($('.ons-card__image').attr('alt')).toBe('');
});
});

describe('with a default placeholder image with `placeholderURL`', () => {
it('outputs an `img` element', () => {
describe('with a default placeholder image with placeholderURL', () => {
it('outputs an img element', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH));

expect($('.ons-card__image')[0].tagName).toBe('img');
});

it('outputs an `img` element with the expected `srcset`', () => {
it('outputs an img element with the expected srcset', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH));

expect($('.ons-card__image').attr('srcset')).toBe(
'/placeholder-image-url/img/small/placeholder-card.png 1x, /placeholder-image-url/img/large/placeholder-card.png 2x',
);
});

it('outputs an `img` element with the expected `src`', () => {
it('outputs an img element with the expected src', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH));

expect($('.ons-card__image').attr('src')).toBe('/placeholder-image-url/img/small/placeholder-card.png');
});

it('outputs an `img` element with the expected empty alt text', () => {
it('outputs an img element with the expected empty alt text', () => {
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH));

expect($('.ons-card__image').attr('alt')).toBe('');
Expand Down

0 comments on commit 41a858d

Please sign in to comment.