@emulsify/core 3.2.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,7 +31,9 @@ describe('a11y', () => {
31
31
  global.console.log.mockClear();
32
32
  global.process.exit.mockClear();
33
33
  });
34
- it('can map axe issue severity to the correct chalk color', () => {
34
+
35
+ it('maps axe issue severity to a label', () => {
36
+ // (Name no longer mentions "chalk")
35
37
  expect.assertions(3);
36
38
  expect(severityToColor('error')).toBe('red');
37
39
  expect(severityToColor('warning')).toBe('yellow');
@@ -56,7 +58,7 @@ describe('a11y', () => {
56
58
  expect(issueIsValid({ code: 'chicken', runnerExtras: {} })).toBe(true);
57
59
  });
58
60
 
59
- it('can use an axe issue to generate a single log message about the issue', () => {
61
+ it('logs a single issue without color codes', () => {
60
62
  expect.assertions(1);
61
63
  logIssue({
62
64
  type: 'error',
@@ -65,16 +67,16 @@ describe('a11y', () => {
65
67
  selector: 'kfc > popeyes > .chicken',
66
68
  });
67
69
  expect(global.console.log.mock.calls[0][0]).toMatchInlineSnapshot(`
68
- "
69
- severity: error
70
- message: this chicken is not fried enough.
71
- context: https://example.com
72
- selector: kfc > popeyes > .chicken
73
- "
74
- `);
70
+ "
71
+ severity: error
72
+ message: this chicken is not fried enough.
73
+ context: https://example.com
74
+ selector: kfc > popeyes > .chicken
75
+ "
76
+ `);
75
77
  });
76
78
 
77
- it('can log a whole axe report', () => {
79
+ it('logs a whole report without color codes', () => {
78
80
  const report = {
79
81
  issues: [
80
82
  {
@@ -96,45 +98,56 @@ describe('a11y', () => {
96
98
  };
97
99
  expect(logReport(report)).toBe(true);
98
100
  expect(global.console.log.mock.calls).toMatchInlineSnapshot(`
99
- Array [
100
- Array [
101
- "Issues found in component: https://example/component.html",
102
- ],
103
- Array [
104
- "
105
- severity: error
106
- message: this pizza is too soggy
107
- context: https://example.com
108
- selector: pizza > .hut
109
- ",
110
- ],
111
- Array [
112
- "
113
- severity: error
114
- message: this pasta is undercooked
115
- context: https://example.com
116
- selector: olive > .garden
117
- ",
118
- ],
119
- ]
120
- `);
101
+ Array [
102
+ Array [
103
+ "Issues found in component: https://example/component.html",
104
+ ],
105
+ Array [
106
+ "
107
+ severity: error
108
+ message: this pizza is too soggy
109
+ context: https://example.com
110
+ selector: pizza > .hut
111
+ ",
112
+ ],
113
+ Array [
114
+ "
115
+ severity: error
116
+ message: this pasta is undercooked
117
+ context: https://example.com
118
+ selector: olive > .garden
119
+ ",
120
+ ],
121
+ ]
122
+ `);
121
123
  });
122
124
 
123
- it('logs about a component having no issue if a report comes back empty', () => {
125
+ it('logs that a component has no issues when a report is empty', () => {
124
126
  expect(logReport({ issues: [], pageUrl: 'papa-johns' })).toBe(false);
125
127
  expect(global.console.log.mock.calls[0][0]).toMatchInlineSnapshot(
126
- `"No issues found in component: papa-johns"`,
128
+ `"No issues found in component: papa-johns"`,
127
129
  );
128
130
  });
129
131
 
130
- it('can call pa11y with the full path to a component', async () => {
131
- expect.assertions(2);
132
+ it('calls pa11y with the full path to a component', async () => {
133
+ expect.assertions(3);
132
134
  await expect(lintComponent('chicken-strips')).resolves.toBe(
133
135
  'very official report',
134
136
  );
135
- expect(pa11y).toHaveBeenCalledWith(
137
+
138
+ // First arg: URL
139
+ expect(pa11y.mock.calls[0][0]).toBe(
136
140
  `${STORYBOOK_IFRAME}?id=chicken-strips`,
137
- pa11yConfig,
141
+ );
142
+
143
+ // Second arg: options merged with defaults in a11y.js
144
+ expect(pa11y.mock.calls[0][1]).toEqual(
145
+ expect.objectContaining({
146
+ includeNotices: true,
147
+ includeWarnings: true,
148
+ runners: ['axe'],
149
+ ...pa11yConfig,
150
+ }),
138
151
  );
139
152
  });
140
153