@@ -3,38 +3,38 @@ import { mount } from "@vue/test-utils";
3
3
import OpenwbBaseButtonGroupInput from "../OpenwbBaseButtonGroupInput.vue" ;
4
4
5
5
describe ( "OpenwbBaseButtonGroupInput.vue" , ( ) => {
6
- // general constants
7
- const title = "Button Group Test" ;
8
- const buttons = [
9
- { buttonValue : 1 , text : "Button 1" } ,
10
- { buttonValue : 2 , text : "Button 2" } ,
11
- ] ;
12
- // check title prop
13
- it ( "render title" , ( ) => {
14
- const wrapper = mount ( OpenwbBaseButtonGroupInput , {
15
- props : { title, buttons } ,
16
- } ) ;
17
- const titleLabel = wrapper . find ( "label.col-form-label" ) ;
18
- expect ( titleLabel . html ( ) ) . toContain ( title ) ;
19
- } ) ;
20
- // check buttons
21
- it ( "render buttons" , ( ) => {
22
- const modelValue = 2 ;
23
- const wrapper = mount ( OpenwbBaseButtonGroupInput , {
24
- props : { buttons, modelValue } ,
25
- } ) ;
26
- const renderedButtons = wrapper . findAll ( "label.btn" ) ;
27
- expect ( renderedButtons [ 0 ] . classes ( "active" ) ) . toBe ( false ) ;
28
- expect ( renderedButtons [ 1 ] . classes ( "active" ) ) . toBe ( true ) ;
29
- } ) ;
30
- // check user input
31
- it ( "emit on click" , async ( ) => {
32
- const modelValue = 2 ;
33
- const wrapper = mount ( OpenwbBaseButtonGroupInput , {
34
- props : { buttons, modelValue } ,
35
- } ) ;
36
- const renderedButtons = wrapper . findAll ( "input[type=radio]" ) ;
37
- await renderedButtons [ 0 ] . setValue ( 1 ) ;
38
- expect ( wrapper . emitted ( "update:modelValue" ) [ 0 ] ) . toStrictEqual ( [ 1 ] ) ;
39
- } ) ;
6
+ // general constants
7
+ const title = "Button Group Test" ;
8
+ const buttons = [
9
+ { buttonValue : 1 , text : "Button 1" } ,
10
+ { buttonValue : 2 , text : "Button 2" } ,
11
+ ] ;
12
+ // check title prop
13
+ it ( "render title" , ( ) => {
14
+ const wrapper = mount ( OpenwbBaseButtonGroupInput , {
15
+ props : { title, buttons } ,
16
+ } ) ;
17
+ const titleLabel = wrapper . find ( "label.col-form-label" ) ;
18
+ expect ( titleLabel . html ( ) ) . toContain ( title ) ;
19
+ } ) ;
20
+ // check buttons
21
+ it ( "render buttons" , ( ) => {
22
+ const modelValue = 2 ;
23
+ const wrapper = mount ( OpenwbBaseButtonGroupInput , {
24
+ props : { buttons, modelValue } ,
25
+ } ) ;
26
+ const renderedButtons = wrapper . findAll ( "label.btn" ) ;
27
+ expect ( renderedButtons [ 0 ] . classes ( "active" ) ) . toBe ( false ) ;
28
+ expect ( renderedButtons [ 1 ] . classes ( "active" ) ) . toBe ( true ) ;
29
+ } ) ;
30
+ // check user input
31
+ it ( "emit on click" , async ( ) => {
32
+ const modelValue = 2 ;
33
+ const wrapper = mount ( OpenwbBaseButtonGroupInput , {
34
+ props : { buttons, modelValue } ,
35
+ } ) ;
36
+ const renderedButtons = wrapper . findAll ( "input[type=radio]" ) ;
37
+ await renderedButtons [ 0 ] . setValue ( 1 ) ;
38
+ expect ( wrapper . emitted ( "update:modelValue" ) [ 0 ] ) . toStrictEqual ( [ 1 ] ) ;
39
+ } ) ;
40
40
} ) ;
0 commit comments