@ministryofjustice/frontend 3.1.0 → 3.2.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.
@@ -12,9 +12,9 @@
12
12
  <li class="moj-pagination__item moj-pagination__item--dots">…</li>
13
13
  {% else %}
14
14
  {%- if item.selected %}
15
- <li class="moj-pagination__item moj-pagination__item--active" aria-label="Page {{ item.text }} of {{ params.results.count }}" aria-current="page">{{ item.text }}</li>
15
+ <li class="moj-pagination__item moj-pagination__item--active" aria-label="Page {{ item.text }} of {{ params.items | length }}" aria-current="page">{{ item.text }}</li>
16
16
  {% else %}
17
- <li class="moj-pagination__item"><a class="moj-pagination__link" href="{{ item.href }}" aria-label="Page {{ item.text }} of {{ params.results.count }}">{{ item.text }}</a></li>
17
+ <li class="moj-pagination__item"><a class="moj-pagination__link" href="{{ item.href }}" aria-label="Page {{ item.text }} of {{ params.items | length }}">{{ item.text }}</a></li>
18
18
  {% endif -%}
19
19
  {% endif -%}
20
20
  {% endfor -%}
@@ -1,8 +1,17 @@
1
1
  const { getByDisplayValue, getByText } = require("@testing-library/dom");
2
- const { axe } = require("jest-axe");
2
+ const { userEvent } = require("@testing-library/user-event");
3
+ const { configureAxe } = require("jest-axe");
3
4
 
4
5
  require("./password-reveal.js");
5
6
 
7
+ const user = userEvent.setup();
8
+ const axe = configureAxe({
9
+ rules: {
10
+ // disable landmark rules when testing isolated components.
11
+ region: { enabled: false },
12
+ },
13
+ });
14
+
6
15
  describe("Password reveal", () => {
7
16
  let container;
8
17
 
@@ -21,16 +30,16 @@ describe("Password reveal", () => {
21
30
  expect(container).toContainElement(getByText(container, "Show"));
22
31
  });
23
32
 
24
- test("toggle reveal", () => {
33
+ test("toggle reveal", async () => {
25
34
  const input = getByDisplayValue(container, "password");
26
35
  const button = getByText(container, "Show");
27
36
 
28
- button.click();
37
+ await user.click(button);
29
38
 
30
39
  expect(input).toHaveAttribute("type", "text");
31
40
  expect(button).toHaveTextContent("Hide");
32
41
 
33
- button.click();
42
+ await user.click(button);
34
43
 
35
44
  expect(input).toHaveAttribute("type", "password");
36
45
  expect(button).toHaveTextContent("Show");
@@ -40,7 +49,7 @@ describe("Password reveal", () => {
40
49
  const button = getByText(container, "Show");
41
50
 
42
51
  expect(await axe(document.body)).toHaveNoViolations();
43
- button.click();
52
+ await user.click(button);
44
53
  expect(await axe(document.body)).toHaveNoViolations();
45
54
  });
46
55
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ministryofjustice/frontend",
3
3
  "description": "The MOJ Frontend contains the code you need to start building user interfaces for UK Ministry of Justice government services.",
4
- "version": "3.1.0",
4
+ "version": "3.2.1",
5
5
  "main": "moj/all.js",
6
6
  "sass": "moj/all.scss",
7
7
  "engines": {