@cfpb/cfpb-design-system 3.4.0 → 3.4.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.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,17 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [3.4.0](https://github.com/cfpb/design-system/compare/v3.3.1..3.4.0) - 2024-11-07
5
+ ## [3.4.1](https://github.com/cfpb/design-system/compare/v3.4.0..3.4.1) - 2024-11-07
6
+
7
+ ### PRs in this release
8
+
9
+ - PR #[2101](https://github.com/cfpb/design-system/pull/2101): Add behavior JS unit tests - Ans
10
+
11
+ ### General
12
+
13
+ - Add behavior specs - ([dd956be](https://github.com/cfpb/design-system/commit/dd956be595a500b2fd654faa9c88700851057eb1)) - Ans
14
+
15
+ ## [3.4.0](https://github.com/cfpb/design-system/compare/v3.3.1..v3.4.0) - 2024-11-07
6
16
 
7
17
  ### PRs in this release
8
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfpb/cfpb-design-system",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "CFPB's UI framework",
5
5
  "main": "src/index.js",
6
6
  "author": {
@@ -57,7 +57,7 @@ describe('atomic-helpers', () => {
57
57
  'Check that element is a DOM node with ' +
58
58
  `class ".${testClass}"`;
59
59
  /**
60
- *
60
+ * Mock error function.
61
61
  */
62
62
  function errFunc() {
63
63
  checkDom(null, testClass);
@@ -68,7 +68,7 @@ describe('atomic-helpers', () => {
68
68
  it('should throw an error if element class not found', () => {
69
69
  const errMsg = 'mock-class not found on or in passed DOM node.';
70
70
  /**
71
- *
71
+ * Mock error function.
72
72
  */
73
73
  function errFunc() {
74
74
  checkDom(componentDom, 'mock-class');
@@ -0,0 +1,36 @@
1
+ import { checkBehaviorDom, behaviorFind } from './behavior.js';
2
+
3
+ let containerDom;
4
+
5
+ const HTML_SNIPPET = `
6
+ <div id="container" data-js-hook="behavior_flyout-menu">
7
+ <button data-js-hook="behavior_flyout-menu_trigger">
8
+ <div data-js-hook="behavior_flyout-menu_content">…</div>
9
+ </div>
10
+ `;
11
+
12
+ describe('behaviors', () => {
13
+ beforeEach(() => {
14
+ document.body.innerHTML = HTML_SNIPPET;
15
+ containerDom = document.querySelector('#container');
16
+ });
17
+
18
+ describe('.checkBehaviorDom()', () => {
19
+ it('should return an HTML element', () => {
20
+ expect(
21
+ checkBehaviorDom(
22
+ containerDom,
23
+ 'behavior_flyout-menu_content',
24
+ ).getAttribute('data-js-hook'),
25
+ ).toBe('behavior_flyout-menu_content');
26
+ });
27
+ });
28
+
29
+ describe('.behaviorFind()', () => {
30
+ it('should return an array with two items when selectors are found', () => {
31
+ const result = behaviorFind('flyout-menu', containerDom);
32
+ expect(result).toBeInstanceOf(NodeList);
33
+ expect(result.length).toBe(2);
34
+ });
35
+ });
36
+ });