From 066fb6dfd4bf31252b01d75883c05e49b3109a38 Mon Sep 17 00:00:00 2001 From: SriHV Date: Fri, 13 Sep 2024 17:03:38 +0100 Subject: [PATCH 01/32] Changes in macro.spec.js --- src/components/button/_macro.spec.js | 677 +++++++++++++-------------- 1 file changed, 315 insertions(+), 362 deletions(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 19c2786ea3..f9b5e9d52d 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -5,296 +5,275 @@ import * as cheerio from 'cheerio'; import axe from '../../tests/helpers/axe'; import { renderComponent, templateFaker } from '../../tests/helpers/rendering'; -describe('macro: button', () => { - it('has the provided `id` attribute', () => { - const $ = cheerio.load( - renderComponent('button', { - id: 'example-id', - }), - ); - - expect($('#example-id').length).toBe(1); - }); - - it('has additionally provided `attributes`', () => { - const $ = cheerio.load( - renderComponent('button', { - attributes: { - a: 123, - b: 456, - }, - }), - ); - - expect($('button').attr('a')).toBe('123'); - expect($('button').attr('b')).toBe('456'); - }); - - it('has expected style classes', () => { - const $ = cheerio.load(renderComponent('button')); - - expect($('.ons-btn .ons-btn__inner').length).toBe(1); - }); - - it('has provided variant style classes', () => { - const $ = cheerio.load( - renderComponent('button', { - variants: ['variant-a', 'variant-b'], - }), - ); - - expect($('.ons-btn').hasClass('ons-btn--variant-a')).toBe(true); - expect($('.ons-btn').hasClass('ons-btn--variant-b')).toBe(true); - }); - - it('has download variant style class when `variants` contains `download`', () => { - const $ = cheerio.load( - renderComponent('button', { - url: 'http://example.com', - variants: 'download', - }), - ); - - expect($('.ons-btn').hasClass('ons-btn--download')).toBe(true); - }); - - it('has `download` icon when `variants` contains "download"', () => { - const faker = templateFaker(); - const iconsSpy = faker.spy('icon'); +describe('FOR: button', () => { + describe('GIVEN: Params: no params', () => { + describe('WHEN: there are no params given', () => { + it('THEN: renders expected style classes', () => { + const $ = cheerio.load(renderComponent('button')); + expect($('.ons-btn .ons-btn__inner').length).toBe(1); + }); - faker.renderComponent('button', { - url: 'http://example.com', - variants: 'download', + it('THEN; renders `button` element', () => { + const $ = cheerio.load(renderComponent('button')); + expect($('button').length).toBe(1); + }); }); - - expect(iconsSpy.occurrences[0].iconType).toBe('download'); - }); - - it('has provided variant style classes when `variants` contains "print"', () => { - const $ = cheerio.load( - renderComponent('button', { - variants: 'print', - }), - ); - - expect($('.ons-btn').hasClass('ons-btn--print')).toBe(true); - expect($('.ons-btn').hasClass('ons-u-d-no')).toBe(true); - expect($('.ons-btn').hasClass('ons-js-print-btn')).toBe(true); }); - - it('has `print` icon when `variants` contains "print"', () => { - const faker = templateFaker(); - const iconsSpy = faker.spy('icon'); - - faker.renderComponent('button', { - url: 'http://example.com', - variants: 'print', + describe('GIVEN: Params: standard', () => { + describe('WHEN: button component is set with standard params', () => { + it('THEN: passes jest-axe checks', async () => { + const $ = cheerio.load( + renderComponent('button', { + text: 'Example button', + name: 'example', + value: 'example-value', + }), + ); + const results = await axe($.html()); + expect(results).toHaveNoViolations(); + }); }); - - expect(iconsSpy.occurrences[0].iconType).toBe('print'); - }); - - it('has provided variant style classes when `variants` contains "loader"', () => { - const $ = cheerio.load( - renderComponent('button', { - variants: 'loader', - }), - ); - - expect($('.ons-btn').hasClass('ons-btn--loader')).toBe(true); - expect($('.ons-btn').hasClass('ons-js-loader')).toBe(true); - expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true); }); - - it('has `loader` icon when `variants` contains "loader"', () => { - const faker = templateFaker(); - const iconsSpy = faker.spy('icon'); - - faker.renderComponent('button', { - variants: 'loader', + describe('GIVEN: Params: id', () => { + describe('WHEN: id is given as parameter', () => { + it('THEN: renders the provided `id` attribute', () => { + const $ = cheerio.load( + renderComponent('button', { + id: 'example-id', + }), + ); + expect($('#example-id').length).toBe(1); + }); }); - - expect(iconsSpy.occurrences[0].iconType).toBe('loader'); }); - - it('has `chevron` icon when `variants` contains "mobile"', () => { - const faker = templateFaker(); - const iconsSpy = faker.spy('icon'); - - faker.renderComponent('button', { - variants: 'mobile', + describe('GIVEN: Params: attributes', () => { + describe('WHEN: attributes is given as parameter', () => { + it('THEN: renders additionally provided `attributes`', () => { + const $ = cheerio.load( + renderComponent('button', { + attributes: { + a: 123, + b: 456, + }, + }), + ); + expect($('button').attr('a')).toBe('123'); + expect($('button').attr('b')).toBe('456'); + }); }); - - expect(iconsSpy.occurrences[0].iconType).toBe('chevron'); - }); - - it('has provided variant style classes when `variants` contains "timer"', () => { - const $ = cheerio.load( - renderComponent('button', { - variants: 'timer', - }), - ); - - expect($('.ons-btn').hasClass('ons-js-timer')).toBe(true); - expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true); - }); - - it('has additionally provided style classes', () => { - const $ = cheerio.load( - renderComponent('button', { - classes: 'extra-class another-extra-class', - }), - ); - - expect($('.ons-btn').hasClass('extra-class')).toBe(true); - expect($('.ons-btn').hasClass('another-extra-class')).toBe(true); - }); - - it('has additionally provided inner style classes', () => { - const $ = cheerio.load( - renderComponent('button', { - innerClasses: 'extra-inner-class another-extra-inner-class', - }), - ); - - expect($('.ons-btn__inner').hasClass('extra-inner-class')).toBe(true); - expect($('.ons-btn__inner').hasClass('another-extra-inner-class')).toBe(true); - }); - - it('has label text when `text` is provided', () => { - const $ = cheerio.load( - renderComponent('button', { - text: 'Click > me!', - }), - ); - - expect($('.ons-btn__text').html()).toBe('Click > me!'); }); - - it('has label text when `html` is provided', () => { - const $ = cheerio.load( - renderComponent('button', { - html: 'Click me!', - }), - ); - - expect($('.ons-btn__text').html()).toBe('Click me!'); + describe('GIVEN: Params: text', () => { + describe('WHEN: text is given as parameter', () => { + it('THEN: renders label text', () => { + const $ = cheerio.load( + renderComponent('button', { + text: 'Click > me!', + }), + ); + expect($('.ons-btn__text').html()).toBe('Click > me!'); + }); + }); }); - - it('has button context text when `buttonContext` is provided', () => { - const $ = cheerio.load( - renderComponent('button', { - buttonContext: 'button context text', - }), - ); - - expect($('.ons-btn__context').text()).toBe('button context text'); + describe('GIVEN: Params: buttonContext', () => { + describe('WHEN: buttonContext parameter is provided', () => { + it('THEN: renders button context text', () => { + const $ = cheerio.load( + renderComponent('button', { + buttonContext: 'button context text', + }), + ); + expect($('.ons-btn__context').text()).toBe('button context text'); + }); + }); }); - - it('has custom icon before button text', () => { - const $ = cheerio.load( - renderComponent('button', { - text: 'Click me!', - iconPosition: 'before', - iconType: 'exit', - }), - ); - - expect($('.ons-icon + .ons-btn__text').text()).toBe('Click me!'); + describe('GIVEN: Params: html', () => { + describe('WHEN: html parameter is provided', () => { + it('THEN: renders label text', () => { + const $ = cheerio.load( + renderComponent('button', { + html: 'Click me!', + }), + ); + expect($('.ons-btn__text').html()).toBe('Click me!'); + }); + }); }); - - it('has custom icon after button text', () => { - const $ = cheerio.load( - renderComponent('button', { - text: 'Click me!', - iconPosition: 'after', - iconType: 'exit', - }), - ); - - expect($('.ons-btn__text + .ons-icon').prev().text()).toBe('Click me!'); + describe('GIVEN: Params: iconPosition', () => { + describe('WHEN: iconPosition is set to before for custom icon', () => { + it('THEN: renders custom icon before button text', () => { + const $ = cheerio.load( + renderComponent('button', { + text: 'Click me!', + iconPosition: 'before', + iconType: 'exit', + }), + ); + expect($('.ons-icon + .ons-btn__text').text()).toBe('Click me!'); + }); + }); + describe('WHEN: iconPosition is set to after for custom icon', () => { + it('THEN: renders custom icon before button text', () => { + const $ = cheerio.load( + renderComponent('button', { + text: 'Click me!', + iconPosition: 'after', + iconType: 'exit', + }), + ); + expect($('.ons-btn__text + .ons-icon').prev().text()).toBe('Click me!'); + }); + }); }); - describe('mode: standard', () => { - it('passes jest-axe checks', async () => { - const $ = cheerio.load( - renderComponent('button', { - text: 'Example button', - name: 'example', - value: 'example-value', - }), - ); - - const results = await axe($.html()); - expect(results).toHaveNoViolations(); + describe('GIVEN: Params: variants', () => { + describe('WHEN: variants are present', () => { + it('THEN: renders provided variant style classes', () => { + const $ = cheerio.load( + renderComponent('button', { + variants: ['variant-a', 'variant-b'], + }), + ); + + expect($('.ons-btn').hasClass('ons-btn--variant-a')).toBe(true); + expect($('.ons-btn').hasClass('ons-btn--variant-b')).toBe(true); + }); }); + describe('WHEN: variants contains download', () => { + it('THEN: renders provided variant style class', () => { + const $ = cheerio.load( + renderComponent('button', { + url: 'http://example.com', + variants: 'download', + }), + ); + expect($('.ons-btn').hasClass('ons-btn--download')).toBe(true); + }); + it('THEN: renders download icon', () => { + const faker = templateFaker(); + const iconsSpy = faker.spy('icon'); - it('is an `button` element', () => { - const $ = cheerio.load(renderComponent('button')); + faker.renderComponent('button', { + url: 'http://example.com', + variants: 'download', + }); - expect($('button').length).toBe(1); + expect(iconsSpy.occurrences[0].iconType).toBe('download'); + }); + it('THEN: renders the download attribute when variants contains download', () => { + const $ = cheerio.load( + renderComponent('button', { + variants: 'download', + }), + ); + + expect($('.ons-btn').attr('download')).toBeDefined(); + }); }); + describe('WHEN: variants contains loader', () => { + it('THEN: renders provided variant style classes', () => { + const $ = cheerio.load( + renderComponent('button', { + variants: 'loader', + }), + ); + + expect($('.ons-btn').hasClass('ons-btn--loader')).toBe(true); + expect($('.ons-btn').hasClass('ons-js-loader')).toBe(true); + expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true); + }); + it('THEN: loader icon when variants contains loader', () => { + const faker = templateFaker(); + const iconsSpy = faker.spy('icon'); - it('has the provided `type` attribute', () => { - const $ = cheerio.load( - renderComponent('button', { - type: 'special-type', - }), - ); + faker.renderComponent('button', { + variants: 'loader', + }); - expect($('button').attr('type')).toBe('special-type'); + expect(iconsSpy.occurrences[0].iconType).toBe('loader'); + }); }); - - it('has the provided `type` attribute even if print variant is provided', () => { - const $ = cheerio.load( - renderComponent('button', { - type: 'special-type', - variants: 'print', - }), - ); - - expect($('button').attr('type')).toBe('special-type'); + describe('WHEN: variants contains timer', () => { + it('THEN: renders provided variant style classes', () => { + const $ = cheerio.load( + renderComponent('button', { + variants: 'timer', + }), + ); + + expect($('.ons-btn').hasClass('ons-js-timer')).toBe(true); + expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true); + }); }); + describe('WHEN: variants contains print', () => { + it('THEN: renders provided variant style classes', () => { + const $ = cheerio.load( + renderComponent('button', { + variants: 'print', + }), + ); + + expect($('.ons-btn').hasClass('ons-btn--print')).toBe(true); + expect($('.ons-btn').hasClass('ons-u-d-no')).toBe(true); + expect($('.ons-btn').hasClass('ons-js-print-btn')).toBe(true); + }); - it('defaults to being a "submit" button when `type` is not provided', () => { - const $ = cheerio.load(renderComponent('button')); - - expect($('button').attr('type')).toBe('submit'); - }); + it('THEN: renders print icon when variants contains print', () => { + const faker = templateFaker(); + const iconsSpy = faker.spy('icon'); - it('defaults to being a "button" when `type` is not provided and `variants` contains "print"', () => { - const $ = cheerio.load( - renderComponent('button', { + faker.renderComponent('button', { + url: 'http://example.com', variants: 'print', - }), - ); + }); - expect($('button').attr('type')).toBe('button'); + expect(iconsSpy.occurrences[0].iconType).toBe('print'); + }); }); + }); + describe('GIVEN: Params: type', () => { + describe('WHEN: type parameter is provided', () => { + it('THEN: renders the provided type attribute', () => { + const $ = cheerio.load( + renderComponent('button', { + type: 'special-type', + }), + ); + + expect($('button').attr('type')).toBe('special-type'); + }); - it('has the provided `value` attribute', () => { - const $ = cheerio.load( - renderComponent('button', { - value: 'special-value', - }), - ); + it('THEN: renders the provided type attribute if variant contains print', () => { + const $ = cheerio.load( + renderComponent('button', { + type: 'special-type', + variants: 'print', + }), + ); - expect($('button').attr('value')).toBe('special-value'); + expect($('button').attr('type')).toBe('special-type'); + }); }); + describe('WHEN: type parameter is not provided', () => { + it('THEN: defaults to being a submit button when type is not provided', () => { + const $ = cheerio.load(renderComponent('button')); - it('has the provided `name` attribute', () => { - const $ = cheerio.load( - renderComponent('button', { - name: 'special-name', - }), - ); + expect($('button').attr('type')).toBe('submit'); + }); + + it('THEN: defaults to being a button if variants contains print', () => { + const $ = cheerio.load( + renderComponent('button', { + variants: 'print', + }), + ); - expect($('button').attr('name')).toBe('special-name'); + expect($('button').attr('type')).toBe('button'); + }); }); }); - describe('mode: link', () => { - it('passes jest-axe checks', async () => { + describe('GIVEN: Params: link', () => { + describe('WHEN: link parameter is provided', () => { const $ = cheerio.load( renderComponent('button', { text: 'Example button', @@ -303,130 +282,104 @@ describe('macro: button', () => { url: 'http://example.com', }), ); + it('THEN: passes jest-axe checks', async () => { + const results = await axe($.html()); + expect(results).toHaveNoViolations(); + }); - const results = await axe($.html()); - expect(results).toHaveNoViolations(); - }); - - it('is an `a` element', () => { - const $ = cheerio.load( - renderComponent('button', { - url: 'http://example.com', - }), - ); - - expect($('a').length).toBe(1); - }); - - it('has expected style classes', () => { - const $ = cheerio.load( - renderComponent('button', { - url: 'http://example.com', - }), - ); - - expect($('a').hasClass('ons-btn')).toBe(true); - expect($('.ons-btn').hasClass('ons-btn--link')).toBe(true); - expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true); - }); - - it('has the provided link', () => { - const $ = cheerio.load( - renderComponent('button', { - url: 'http://example.com', - }), - ); - - expect($('a').attr('href')).toBe('http://example.com'); - }); + it('THEN: renders an `a` element', () => { + expect($('a').length).toBe(1); + }); - it('has `arrow-next` icon by default', () => { - const faker = templateFaker(); - const iconsSpy = faker.spy('icon'); + it('THEN: renders expected style classes', () => { + expect($('a').hasClass('ons-btn')).toBe(true); + expect($('.ons-btn').hasClass('ons-btn--link')).toBe(true); + expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true); + }); - faker.renderComponent('button', { - url: 'http://example.com', + it('THEN: contains the provided link', () => { + expect($('a').attr('href')).toBe('http://example.com'); }); - expect(iconsSpy.occurrences[0].iconType).toBe('arrow-next'); - }); + it('THEN: contains arrow-next icon by default', () => { + const faker = templateFaker(); + const iconsSpy = faker.spy('icon'); - it('opens in a new window when `newWindow` is `true`', () => { - const $ = cheerio.load( - renderComponent('button', { + faker.renderComponent('button', { url: 'http://example.com', - newWindow: true, - }), - ); - - expect($('a').attr('target')).toBe('_blank'); - expect($('a').attr('rel')).toBe('noopener'); - }); + }); - it('has `external-link` icon when `newWindow` is `true`', () => { - const faker = templateFaker(); - const iconsSpy = faker.spy('icon'); - - faker.renderComponent('button', { - url: 'http://example.com', - newWindow: true, + expect(iconsSpy.occurrences[0].iconType).toBe('arrow-next'); }); - expect(iconsSpy.occurrences[0].iconType).toBe('external-link'); + it('THEN: contains the button role', () => { + expect($('.ons-btn').attr('role')).toBe('button'); + }); }); - - it('has the `button` role', () => { - const $ = cheerio.load( - renderComponent('button', { - url: 'http://example.com', - }), - ); - - expect($('.ons-btn').attr('role')).toBe('button'); + describe('WHEN: link parameter is provided and newWindow is true', () => { + it('THEN: renders a default new window description', () => { + const $ = cheerio.load( + renderComponent('button', { + url: 'http://example.com', + newWindow: true, + }), + ); + expect($('.ons-btn__new-window-description').text()).toBe(' (opens in a new tab)'); + }); }); - - it('has a default new window description when `newWindow` is `true`', () => { - const $ = cheerio.load( - renderComponent('button', { - url: 'http://example.com', - newWindow: true, - }), - ); - - expect($('.ons-btn__new-window-description').text()).toBe(' (opens in a new tab)'); + describe('WHEN: link parameter is provided, newWindow is true and newWindowDescription is provided', () => { + it('THEN: contains a custom new window description', () => { + const $ = cheerio.load( + renderComponent('button', { + url: 'http://example.com', + newWindow: true, + newWindowDescription: 'custom opens in a new window text', + }), + ); + expect($('.ons-btn__new-window-description').text()).toBe(' (custom opens in a new window text)'); + }); }); + }); - it('has a custom new window description when `newWindow` is `true` and `newWindowDescription` is provided', () => { - const $ = cheerio.load( - renderComponent('button', { - url: 'http://example.com', - newWindow: true, - newWindowDescription: 'custom opens in a new window text', - }), - ); - - expect($('.ons-btn__new-window-description').text()).toBe(' (custom opens in a new window text)'); + describe('GIVEN: Params: additonal classes', () => { + describe('WHEN: classes parameter is provided', () => { + it('THENL renders additionally provided style classes', () => { + const $ = cheerio.load( + renderComponent('button', { + classes: 'extra-class another-extra-class', + }), + ); + + expect($('.ons-btn').hasClass('extra-class')).toBe(true); + expect($('.ons-btn').hasClass('another-extra-class')).toBe(true); + }); }); - - it('has the `download` attribute when `variants` contains "download"', () => { - const $ = cheerio.load( - renderComponent('button', { - variants: 'download', - }), - ); - - expect($('.ons-btn').attr('download')).toBeDefined(); + describe('WHEN: innerclasses parameter is provided', () => { + it('THEN: renders additionally provided inner style classes', () => { + const $ = cheerio.load( + renderComponent('button', { + innerClasses: 'extra-inner-class another-extra-inner-class', + }), + ); + + expect($('.ons-btn__inner').hasClass('extra-inner-class')).toBe(true); + expect($('.ons-btn__inner').hasClass('another-extra-inner-class')).toBe(true); + }); }); + }); - it('does not have the `download` attribute when `variants` contains "download" and `removeDownloadAttribute` is `true`', () => { - const $ = cheerio.load( - renderComponent('button', { - variants: 'download', - removeDownloadAttribute: true, - }), - ); - - expect($('.ons-btn').attr('download')).toBeUndefined(); + describe('GIVEN: params: removeDownloadattribute', () => { + describe('WHEN: variants contains download and removeDownloadAttribute is true', () => { + it('THEN: does not have the download attribute', () => { + const $ = cheerio.load( + renderComponent('button', { + variants: 'download', + removeDownloadAttribute: true, + }), + ); + + expect($('.ons-btn').attr('download')).toBeUndefined(); + }); }); }); }); From f3644e12c23a211d4bce08248a13d3b4a1547012 Mon Sep 17 00:00:00 2001 From: SriHV Date: Thu, 3 Oct 2024 17:08:43 +0100 Subject: [PATCH 02/32] changes as per comments --- src/components/button/_macro.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index f9b5e9d52d..fd8f8d7ef1 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -5,7 +5,7 @@ import * as cheerio from 'cheerio'; import axe from '../../tests/helpers/axe'; import { renderComponent, templateFaker } from '../../tests/helpers/rendering'; -describe('FOR: button', () => { +describe('FOR: Macro: Button', () => { describe('GIVEN: Params: no params', () => { describe('WHEN: there are no params given', () => { it('THEN: renders expected style classes', () => { @@ -13,7 +13,7 @@ describe('FOR: button', () => { expect($('.ons-btn .ons-btn__inner').length).toBe(1); }); - it('THEN; renders `button` element', () => { + it('THEN: the button is rendered', () => { const $ = cheerio.load(renderComponent('button')); expect($('button').length).toBe(1); }); From 99674df5459bfd1811099207f19dfc538e024fda Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:11:31 +0100 Subject: [PATCH 03/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index fd8f8d7ef1..10454be2c0 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -36,7 +36,7 @@ describe('FOR: Macro: Button', () => { }); describe('GIVEN: Params: id', () => { describe('WHEN: id is given as parameter', () => { - it('THEN: renders the provided `id` attribute', () => { + it('THEN: the button has the provided id', () => { const $ = cheerio.load( renderComponent('button', { id: 'example-id', From a2ed68a8cbca74a6628f1b2954dc97241a373d89 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:11:38 +0100 Subject: [PATCH 04/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 10454be2c0..e098757b0e 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -48,7 +48,7 @@ describe('FOR: Macro: Button', () => { }); describe('GIVEN: Params: attributes', () => { describe('WHEN: attributes is given as parameter', () => { - it('THEN: renders additionally provided `attributes`', () => { + it('THEN: the button has the additionally provided attributes', () => { const $ = cheerio.load( renderComponent('button', { attributes: { From 2f410d25568e2d555d426216a59b3f302f8663e8 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:11:47 +0100 Subject: [PATCH 05/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index e098757b0e..06b5285035 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -287,7 +287,7 @@ describe('FOR: Macro: Button', () => { expect(results).toHaveNoViolations(); }); - it('THEN: renders an `a` element', () => { + it('THEN: renders an element', () => { expect($('a').length).toBe(1); }); From 84fe7b011ec752387caa8d432f6aab77fced8a91 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:11:56 +0100 Subject: [PATCH 06/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 06b5285035..b1222e77e3 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -297,7 +297,7 @@ describe('FOR: Macro: Button', () => { expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true); }); - it('THEN: contains the provided link', () => { + it('THEN: the link points to the provided url', () => { expect($('a').attr('href')).toBe('http://example.com'); }); From 6359eb230404678c86e98602789539f8209b24c8 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:12:19 +0100 Subject: [PATCH 07/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index b1222e77e3..38f6ad4006 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -272,8 +272,8 @@ describe('FOR: Macro: Button', () => { }); }); - describe('GIVEN: Params: link', () => { - describe('WHEN: link parameter is provided', () => { + describe('GIVEN: Params: url', () => { + describe('WHEN: url parameter is provided', () => { const $ = cheerio.load( renderComponent('button', { text: 'Example button', From ae03def164d8494f74988e53e760e273314eaa0a Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:12:26 +0100 Subject: [PATCH 08/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 38f6ad4006..ee1022022f 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -301,7 +301,7 @@ describe('FOR: Macro: Button', () => { expect($('a').attr('href')).toBe('http://example.com'); }); - it('THEN: contains arrow-next icon by default', () => { + it('THEN: the link button has the arrow-next icon by default', () => { const faker = templateFaker(); const iconsSpy = faker.spy('icon'); From 5ebc1c12df678371d83e0e1168fcde67945f30fb Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:12:45 +0100 Subject: [PATCH 09/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index ee1022022f..9c1ca0c7e9 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -370,7 +370,7 @@ describe('FOR: Macro: Button', () => { describe('GIVEN: params: removeDownloadattribute', () => { describe('WHEN: variants contains download and removeDownloadAttribute is true', () => { - it('THEN: does not have the download attribute', () => { + it('THEN: the button does not have the download attribute', () => { const $ = cheerio.load( renderComponent('button', { variants: 'download', From 70254b8d5f90347388e670b74a1ee1ada98633b5 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:12:54 +0100 Subject: [PATCH 10/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 9c1ca0c7e9..fc3705a92a 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -343,7 +343,7 @@ describe('FOR: Macro: Button', () => { describe('GIVEN: Params: additonal classes', () => { describe('WHEN: classes parameter is provided', () => { - it('THENL renders additionally provided style classes', () => { + it('THEN: the button has the additionally provided style classes', () => { const $ = cheerio.load( renderComponent('button', { classes: 'extra-class another-extra-class', From bcc431622e09bef710d0f5bfcf9ec263c3f70b05 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:13:01 +0100 Subject: [PATCH 11/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index fc3705a92a..cb5dc3241f 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -368,7 +368,7 @@ describe('FOR: Macro: Button', () => { }); }); - describe('GIVEN: params: removeDownloadattribute', () => { + describe('GIVEN: Params: removeDownloadattribute', () => { describe('WHEN: variants contains download and removeDownloadAttribute is true', () => { it('THEN: the button does not have the download attribute', () => { const $ = cheerio.load( From 8b058aa2519b9fdd89e4bc6e6aceb5e6a9a636ff Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:13:09 +0100 Subject: [PATCH 12/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index cb5dc3241f..be33443ac1 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -355,7 +355,7 @@ describe('FOR: Macro: Button', () => { }); }); describe('WHEN: innerclasses parameter is provided', () => { - it('THEN: renders additionally provided inner style classes', () => { + it('THEN: the button inner has the additionally provided inner style classes', () => { const $ = cheerio.load( renderComponent('button', { innerClasses: 'extra-inner-class another-extra-inner-class', From 3f19ff428ba4258a14734d840e13b4f7deff5d85 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:13:17 +0100 Subject: [PATCH 13/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index be33443ac1..832a03431c 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -327,7 +327,7 @@ describe('FOR: Macro: Button', () => { expect($('.ons-btn__new-window-description').text()).toBe(' (opens in a new tab)'); }); }); - describe('WHEN: link parameter is provided, newWindow is true and newWindowDescription is provided', () => { + describe('WHEN: url parameter is provided, newWindow is true and newWindowDescription is provided', () => { it('THEN: contains a custom new window description', () => { const $ = cheerio.load( renderComponent('button', { From c23e2cd5c68a7ff21add551ad02a546599e98042 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:13:24 +0100 Subject: [PATCH 14/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 832a03431c..604b0ddd5c 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -317,7 +317,7 @@ describe('FOR: Macro: Button', () => { }); }); describe('WHEN: link parameter is provided and newWindow is true', () => { - it('THEN: renders a default new window description', () => { + it('THEN: has default new window description', () => { const $ = cheerio.load( renderComponent('button', { url: 'http://example.com', From 219d8b5293bf5e3684651f04c587a0d79adbeb3c Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:13:33 +0100 Subject: [PATCH 15/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 604b0ddd5c..119685dc7c 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -328,7 +328,7 @@ describe('FOR: Macro: Button', () => { }); }); describe('WHEN: url parameter is provided, newWindow is true and newWindowDescription is provided', () => { - it('THEN: contains a custom new window description', () => { + it('THEN: has custom new window description', () => { const $ = cheerio.load( renderComponent('button', { url: 'http://example.com', From 76f67eeee66f3acf4b7006ab1912ce0abb46e9fe Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:13:41 +0100 Subject: [PATCH 16/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 119685dc7c..a90e23e91d 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -316,7 +316,7 @@ describe('FOR: Macro: Button', () => { expect($('.ons-btn').attr('role')).toBe('button'); }); }); - describe('WHEN: link parameter is provided and newWindow is true', () => { + describe('WHEN: url parameter is provided and newWindow is true', () => { it('THEN: has default new window description', () => { const $ = cheerio.load( renderComponent('button', { From eaa1f07b35c7a2873c111b393af9ade8226592f2 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:13:48 +0100 Subject: [PATCH 17/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index a90e23e91d..2b96655383 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -312,7 +312,7 @@ describe('FOR: Macro: Button', () => { expect(iconsSpy.occurrences[0].iconType).toBe('arrow-next'); }); - it('THEN: contains the button role', () => { + it('THEN: the role attribute is set to button', () => { expect($('.ons-btn').attr('role')).toBe('button'); }); }); From 1b56c6a7dbfa527f39cfb2098fa77f1d68e2ad3b Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:13:54 +0100 Subject: [PATCH 18/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 2b96655383..cccaa9fbf6 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -291,7 +291,7 @@ describe('FOR: Macro: Button', () => { expect($('a').length).toBe(1); }); - it('THEN: renders expected style classes', () => { + it('THEN: has expected style classes', () => { expect($('a').hasClass('ons-btn')).toBe(true); expect($('.ons-btn').hasClass('ons-btn--link')).toBe(true); expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true); From 7f4877fe0c55eb650880e12263d8c94034e817bd Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:14:00 +0100 Subject: [PATCH 19/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index cccaa9fbf6..f989fbdefc 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -232,7 +232,7 @@ describe('FOR: Macro: Button', () => { }); describe('GIVEN: Params: type', () => { describe('WHEN: type parameter is provided', () => { - it('THEN: renders the provided type attribute', () => { + it('THEN: has the provided type attribute', () => { const $ = cheerio.load( renderComponent('button', { type: 'special-type', From ca842c994c989bfc0d29befcb521f697d770547e Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:14:10 +0100 Subject: [PATCH 20/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index f989fbdefc..5eaa63e35f 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -112,7 +112,7 @@ describe('FOR: Macro: Button', () => { }); }); describe('WHEN: iconPosition is set to after for custom icon', () => { - it('THEN: renders custom icon before button text', () => { + it('THEN: renders custom icon after button text', () => { const $ = cheerio.load( renderComponent('button', { text: 'Click me!', From e03f1585d05ece49ce775b9ec60503748b07ad81 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:14:16 +0100 Subject: [PATCH 21/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 5eaa63e35f..40ad7046bc 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -127,7 +127,7 @@ describe('FOR: Macro: Button', () => { describe('GIVEN: Params: variants', () => { describe('WHEN: variants are present', () => { - it('THEN: renders provided variant style classes', () => { + it('THEN: the button has the expected variant classes', () => { const $ = cheerio.load( renderComponent('button', { variants: ['variant-a', 'variant-b'], From 52be6c302f7114214fc6d772ac0c0de277b15a6d Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:14:22 +0100 Subject: [PATCH 22/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 40ad7046bc..8f80fa24ad 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -159,7 +159,7 @@ describe('FOR: Macro: Button', () => { expect(iconsSpy.occurrences[0].iconType).toBe('download'); }); - it('THEN: renders the download attribute when variants contains download', () => { + it('THEN: the button has the download attribute', () => { const $ = cheerio.load( renderComponent('button', { variants: 'download', From 035fbce70e435b5a9030701f3ad4f3e0cd26c479 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:14:28 +0100 Subject: [PATCH 23/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 8f80fa24ad..efb49b7da1 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -139,7 +139,7 @@ describe('FOR: Macro: Button', () => { }); }); describe('WHEN: variants contains download', () => { - it('THEN: renders provided variant style class', () => { + it('THEN: the button has the download class', () => { const $ = cheerio.load( renderComponent('button', { url: 'http://example.com', From 31b1311eef02faafb74d2ca6fa8cae5044280917 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:14:35 +0100 Subject: [PATCH 24/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index efb49b7da1..67a350e919 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -148,7 +148,7 @@ describe('FOR: Macro: Button', () => { ); expect($('.ons-btn').hasClass('ons-btn--download')).toBe(true); }); - it('THEN: renders download icon', () => { + it('THEN: the button has the download icon', () => { const faker = templateFaker(); const iconsSpy = faker.spy('icon'); From 7c47f8a708e317d1b439600ecc75fe17794a3801 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:14:43 +0100 Subject: [PATCH 25/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 67a350e919..7508e3bf09 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -242,7 +242,7 @@ describe('FOR: Macro: Button', () => { expect($('button').attr('type')).toBe('special-type'); }); - it('THEN: renders the provided type attribute if variant contains print', () => { + it('THEN: has the provided type attribute if variant contains print', () => { const $ = cheerio.load( renderComponent('button', { type: 'special-type', From dd9bc1f4efd992ae3e8bb1df24367eca178047be Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:14:55 +0100 Subject: [PATCH 26/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 7508e3bf09..940880eb9d 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -254,7 +254,7 @@ describe('FOR: Macro: Button', () => { }); }); describe('WHEN: type parameter is not provided', () => { - it('THEN: defaults to being a submit button when type is not provided', () => { + it('THEN: defaults to being a submit button', () => { const $ = cheerio.load(renderComponent('button')); expect($('button').attr('type')).toBe('submit'); From 67a25b19223038684e23f7f06f4f6f12a3718d4e Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:15:17 +0100 Subject: [PATCH 27/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 940880eb9d..dc256380e4 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -217,7 +217,7 @@ describe('FOR: Macro: Button', () => { expect($('.ons-btn').hasClass('ons-js-print-btn')).toBe(true); }); - it('THEN: renders print icon when variants contains print', () => { + it('THEN: button has the print icon', () => { const faker = templateFaker(); const iconsSpy = faker.spy('icon'); From 499001f633c851f2d92d0b7334d323915dbc0aba Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:15:31 +0100 Subject: [PATCH 28/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index dc256380e4..2d3c98601e 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -193,7 +193,7 @@ describe('FOR: Macro: Button', () => { }); }); describe('WHEN: variants contains timer', () => { - it('THEN: renders provided variant style classes', () => { + it('THEN: the button has the timer classes', () => { const $ = cheerio.load( renderComponent('button', { variants: 'timer', From 7afdd9d7410d7f931c1eb23ce7f688dc0ec6239b Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:15:45 +0100 Subject: [PATCH 29/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 2d3c98601e..8a0d57eda9 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -181,7 +181,7 @@ describe('FOR: Macro: Button', () => { expect($('.ons-btn').hasClass('ons-js-loader')).toBe(true); expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true); }); - it('THEN: loader icon when variants contains loader', () => { + it('THEN: the button has the loader icon', () => { const faker = templateFaker(); const iconsSpy = faker.spy('icon'); From a93e8af2da4e24e9f3294a95567b331621f7da00 Mon Sep 17 00:00:00 2001 From: SriHV <123635670+SriHV@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:15:59 +0100 Subject: [PATCH 30/32] Update src/components/button/_macro.spec.js Co-authored-by: rmccar <42928680+rmccar@users.noreply.github.com> --- src/components/button/_macro.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 8a0d57eda9..6032243505 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -170,7 +170,7 @@ describe('FOR: Macro: Button', () => { }); }); describe('WHEN: variants contains loader', () => { - it('THEN: renders provided variant style classes', () => { + it('THEN: the button has the loader classes', () => { const $ = cheerio.load( renderComponent('button', { variants: 'loader', From dea8095f95d61f2bc1c5e3d5a4a37c71446e1829 Mon Sep 17 00:00:00 2001 From: SriHV Date: Thu, 3 Oct 2024 17:24:27 +0100 Subject: [PATCH 31/32] changes as per comments --- src/components/button/_macro.spec.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index 6032243505..d2c8c3d0de 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -7,8 +7,8 @@ import { renderComponent, templateFaker } from '../../tests/helpers/rendering'; describe('FOR: Macro: Button', () => { describe('GIVEN: Params: no params', () => { - describe('WHEN: there are no params given', () => { - it('THEN: renders expected style classes', () => { + describe('WHEN: there are no params provided', () => { + it('THEN: has expected style classes', () => { const $ = cheerio.load(renderComponent('button')); expect($('.ons-btn .ons-btn__inner').length).toBe(1); }); @@ -19,8 +19,8 @@ describe('FOR: Macro: Button', () => { }); }); }); - describe('GIVEN: Params: standard', () => { - describe('WHEN: button component is set with standard params', () => { + describe('GIVEN: Params: text, name and value', () => { + describe('WHEN: text, name and value params are provided', () => { it('THEN: passes jest-axe checks', async () => { const $ = cheerio.load( renderComponent('button', { @@ -35,7 +35,7 @@ describe('FOR: Macro: Button', () => { }); }); describe('GIVEN: Params: id', () => { - describe('WHEN: id is given as parameter', () => { + describe('WHEN: the id param is provided', () => { it('THEN: the button has the provided id', () => { const $ = cheerio.load( renderComponent('button', { @@ -47,7 +47,7 @@ describe('FOR: Macro: Button', () => { }); }); describe('GIVEN: Params: attributes', () => { - describe('WHEN: attributes is given as parameter', () => { + describe('WHEN: the attributes param is provided', () => { it('THEN: the button has the additionally provided attributes', () => { const $ = cheerio.load( renderComponent('button', { @@ -63,8 +63,8 @@ describe('FOR: Macro: Button', () => { }); }); describe('GIVEN: Params: text', () => { - describe('WHEN: text is given as parameter', () => { - it('THEN: renders label text', () => { + describe('WHEN: the text param is provided', () => { + it('THEN: the button has the label text', () => { const $ = cheerio.load( renderComponent('button', { text: 'Click > me!', @@ -76,7 +76,7 @@ describe('FOR: Macro: Button', () => { }); describe('GIVEN: Params: buttonContext', () => { describe('WHEN: buttonContext parameter is provided', () => { - it('THEN: renders button context text', () => { + it('THEN: the button has the provided button context', () => { const $ = cheerio.load( renderComponent('button', { buttonContext: 'button context text', @@ -88,7 +88,7 @@ describe('FOR: Macro: Button', () => { }); describe('GIVEN: Params: html', () => { describe('WHEN: html parameter is provided', () => { - it('THEN: renders label text', () => { + it('THEN: the button label has the provided html', () => { const $ = cheerio.load( renderComponent('button', { html: 'Click me!', From 5a5c6387ca168872cbc301f7051add1c25397275 Mon Sep 17 00:00:00 2001 From: SriHV Date: Fri, 4 Oct 2024 14:02:34 +0100 Subject: [PATCH 32/32] changes as per comments --- src/components/button/_macro.spec.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index d2c8c3d0de..b1a28fff88 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -241,8 +241,9 @@ describe('FOR: Macro: Button', () => { expect($('button').attr('type')).toBe('special-type'); }); - - it('THEN: has the provided type attribute if variant contains print', () => { + }); + describe('WHEN: type parameter is provided and variant contains print', () => { + it('THEN: has the provided type attribute', () => { const $ = cheerio.load( renderComponent('button', { type: 'special-type', @@ -259,8 +260,9 @@ describe('FOR: Macro: Button', () => { expect($('button').attr('type')).toBe('submit'); }); - - it('THEN: defaults to being a button if variants contains print', () => { + }); + describe('WHEN: type parameter is not provided and variant contains print', () => { + it('THEN: defaults to being a button', () => { const $ = cheerio.load( renderComponent('button', { variants: 'print', @@ -324,7 +326,7 @@ describe('FOR: Macro: Button', () => { newWindow: true, }), ); - expect($('.ons-btn__new-window-description').text()).toBe(' (opens in a new tab)'); + expect($('.ons-btn__new-window-description').text()).toBe('(opens in a new tab)'); }); }); describe('WHEN: url parameter is provided, newWindow is true and newWindowDescription is provided', () => { @@ -336,7 +338,7 @@ describe('FOR: Macro: Button', () => { newWindowDescription: 'custom opens in a new window text', }), ); - expect($('.ons-btn__new-window-description').text()).toBe(' (custom opens in a new window text)'); + expect($('.ons-btn__new-window-description').text()).toBe('(custom opens in a new window text)'); }); }); });