@kiva/kv-components 3.9.1 → 3.10.0
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
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.10.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.9.1...@kiva/kv-components@3.10.0) (2022-11-09)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* smooth out transition by apply styling to child div ([8f629d7](https://github.com/kiva/kv-ui-elements/commit/8f629d7659aec83493797e8b1bb9d4540457686a))
|
|
12
|
+
* test multiline content for broken state, add .stop event modifier on FAQ icon click ([e4758d5](https://github.com/kiva/kv-ui-elements/commit/e4758d5103233007c5c497b310e5cf4c994885aa))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* created tests in order to fix FAQ Arrow Functionality ([7bc7c54](https://github.com/kiva/kv-ui-elements/commit/7bc7c54258cb83f74b127f9c5985ff56ba3e9129))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [3.9.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.9.0...@kiva/kv-components@3.9.1) (2022-10-14)
|
|
7
24
|
|
|
8
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"optional": true
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "6c36724fbfad7b16e6fc613769bb3ec9c5d682c0"
|
|
73
73
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { fireEvent, render } from '@testing-library/vue';
|
|
2
|
+
import KvExpandableQuestion from '../../../../vue/KvExpandableQuestion.vue';
|
|
3
|
+
|
|
4
|
+
describe('KvExpandableQuestion', () => {
|
|
5
|
+
it('renders KvExpandableQuestion that opens and closes when clicking the title', async () => {
|
|
6
|
+
const { getByText } = render(KvExpandableQuestion, {
|
|
7
|
+
props: {
|
|
8
|
+
title: 'Kv Expandable Question',
|
|
9
|
+
id: 'kv-expandable-question',
|
|
10
|
+
},
|
|
11
|
+
slots: { default: 'Test Question' },
|
|
12
|
+
});
|
|
13
|
+
const titleContent = getByText('Kv Expandable Question');
|
|
14
|
+
expect(titleContent).toBeDefined();
|
|
15
|
+
expect(getByText('Test Question')).not.toBeVisible();
|
|
16
|
+
await fireEvent.click(titleContent);
|
|
17
|
+
expect(getByText('Test Question')).toBeVisible();
|
|
18
|
+
await fireEvent.click(titleContent);
|
|
19
|
+
expect(getByText('Test Question')).not.toBeVisible();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('renders KvExpandableQuestion that opens and closes when clicking the arrow', async () => {
|
|
23
|
+
const { container, getByText } = render(KvExpandableQuestion, {
|
|
24
|
+
props: {
|
|
25
|
+
title: 'Kv Expandable Question',
|
|
26
|
+
id: 'kv-expandable-question',
|
|
27
|
+
testid: 'test-expandable',
|
|
28
|
+
},
|
|
29
|
+
// establish some multi line content
|
|
30
|
+
slots: { default: '<p>renders KvExpandableQuestion that opens and closes when clicking the arrow renders KvExpandableQuestion</p> <p>that opens and closes when clicking the arrow</p> <p>Test Question</p>' },
|
|
31
|
+
});
|
|
32
|
+
const spanEl = container.querySelector("[role='img']");
|
|
33
|
+
const svgEl = container.querySelector("[viewBox= '0 0 24 24']");
|
|
34
|
+
|
|
35
|
+
// Check State prior to clicking Icon
|
|
36
|
+
expect(svgEl).toBeVisible();
|
|
37
|
+
expect(getByText('Test Question')).not.toBeVisible();
|
|
38
|
+
|
|
39
|
+
// Click icon to open expandable and check content visibility
|
|
40
|
+
await fireEvent.click(spanEl);
|
|
41
|
+
const firstLineOpen = getByText('renders KvExpandableQuestion that opens and closes when clicking the arrow renders KvExpandableQuestion');
|
|
42
|
+
expect(firstLineOpen).toBeVisible();
|
|
43
|
+
|
|
44
|
+
const lastLineOpen = getByText('Test Question');
|
|
45
|
+
expect(lastLineOpen).toBeVisible();
|
|
46
|
+
|
|
47
|
+
// Click icon and check content visibility
|
|
48
|
+
await fireEvent.click(spanEl);
|
|
49
|
+
const firstLineClosed = getByText('renders KvExpandableQuestion that opens and closes when clicking the arrow renders KvExpandableQuestion');
|
|
50
|
+
expect(firstLineClosed).not.toBeVisible();
|
|
51
|
+
|
|
52
|
+
const lastLineClosed = getByText('Test Question');
|
|
53
|
+
expect(lastLineClosed).not.toBeVisible();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -10,19 +10,18 @@
|
|
|
10
10
|
<kv-material-icon
|
|
11
11
|
class="tw-w-4 tw-h-4"
|
|
12
12
|
:icon="open ? mdiChevronUp : mdiChevronDown"
|
|
13
|
-
@click="toggleFAQ"
|
|
13
|
+
@click.stop="toggleFAQ"
|
|
14
14
|
/>
|
|
15
15
|
</button>
|
|
16
16
|
<kv-expandable easing="ease-in-out">
|
|
17
|
-
<div
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
>
|
|
17
|
+
<div v-show="open">
|
|
18
|
+
<div class="tw-prose tw-pb-4 tw-pt-2">
|
|
19
|
+
<slot></slot>
|
|
20
|
+
<div
|
|
21
|
+
v-if="content !== ''"
|
|
22
|
+
v-html="content"
|
|
23
|
+
>
|
|
24
|
+
</div>
|
|
26
25
|
</div>
|
|
27
26
|
</div>
|
|
28
27
|
</kv-expandable>
|