From b5acdc9124cce9cb6aaa88e6a494f6dcdb3dcb72 Mon Sep 17 00:00:00 2001 From: Matthias Goudjil Date: Thu, 2 Nov 2023 15:21:19 +0100 Subject: [PATCH] feat: [divider] - add data-test attribute --- packages/components/divider/src/divider.ts | 5 +++++ packages/components/divider/src/divider.vue | 2 ++ packages/components/divider/test/divider.spec.ts | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/packages/components/divider/src/divider.ts b/packages/components/divider/src/divider.ts index 6772d62e..967a1a8b 100644 --- a/packages/components/divider/src/divider.ts +++ b/packages/components/divider/src/divider.ts @@ -19,6 +19,11 @@ export const dividerProps = buildProps({ required: false, default: PuikDividerOrientation.HORIZONTAL, }, + dataTest: { + type: String, + required: false, + default: undefined, + }, } as const) export type DividerProps = ExtractPropTypes diff --git a/packages/components/divider/src/divider.vue b/packages/components/divider/src/divider.vue index 95debdc5..d719f5be 100644 --- a/packages/components/divider/src/divider.vue +++ b/packages/components/divider/src/divider.vue @@ -2,10 +2,12 @@
diff --git a/packages/components/divider/test/divider.spec.ts b/packages/components/divider/test/divider.spec.ts index 0e95b0c3..2be05992 100644 --- a/packages/components/divider/test/divider.spec.ts +++ b/packages/components/divider/test/divider.spec.ts @@ -21,8 +21,14 @@ describe('Divider tests', () => { factory() expect(wrapper).toBeTruthy() }) + it('should be a vertical divider', () => { factory({ orientation: 'vertical' }) expect(findDivider().classes()).toContain('puik-divider--vertical') }) + + it('the value of the data-test attribute should be "vertical-test"', () => { + factory({ orientation: 'vertical', dataTest: 'test' }) + expect(findDivider().attributes('data-test')).toBe('vertical-test') + }) })