@@ -32,6 +32,7 @@ let question: Question = {
3232 id : 1 ,
3333 text : "Should we use a component for rendering actions?" ,
3434 options : [ "no" , "maybe" , "sure" ] ,
35+ optionLabels : [ "Nein" , "Vielleicht" , "Sicher" ] ,
3536 defaultOption,
3637} ;
3738
@@ -41,6 +42,7 @@ const renderQuestionActions = () =>
4142 installerRender (
4243 < QuestionActions
4344 actions = { question . options }
45+ actionLabels = { question . optionLabels }
4446 defaultAction = { question . defaultOption }
4547 actionCallback = { actionCallback }
4648 conditions = { { disable : { no : true } } }
@@ -52,17 +54,17 @@ describe("QuestionActions", () => {
5254 it ( "renders the default option as primary action" , async ( ) => {
5355 renderQuestionActions ( ) ;
5456
55- const button = await screen . findByRole ( "button" , { name : "Sure " } ) ;
57+ const button = await screen . findByRole ( "button" , { name : "Sicher " } ) ;
5658 expect ( button . classList . contains ( "pf-m-primary" ) ) . toBe ( true ) ;
5759 } ) ;
5860
5961 it ( "renders non default options as secondary actions" , async ( ) => {
6062 renderQuestionActions ( ) ;
6163
62- let button = await screen . findByRole ( "button" , { name : "Maybe " } ) ;
64+ let button = await screen . findByRole ( "button" , { name : "Vielleicht " } ) ;
6365 expect ( button . classList . contains ( "pf-m-secondary" ) ) . toBe ( true ) ;
6466
65- button = await screen . findByRole ( "button" , { name : "No " } ) ;
67+ button = await screen . findByRole ( "button" , { name : "Nein " } ) ;
6668 expect ( button . classList . contains ( "pf-m-secondary" ) ) . toBe ( true ) ;
6769 } ) ;
6870 } ) ;
@@ -77,35 +79,35 @@ describe("QuestionActions", () => {
7779 it ( "renders the first option as primary action" , async ( ) => {
7880 renderQuestionActions ( ) ;
7981
80- const button = await screen . findByRole ( "button" , { name : "No " } ) ;
82+ const button = await screen . findByRole ( "button" , { name : "Nein " } ) ;
8183 expect ( button . classList . contains ( "pf-m-primary" ) ) . toBe ( true ) ;
8284 } ) ;
8385
8486 it ( "renders the other options as secondary actions" , async ( ) => {
8587 renderQuestionActions ( ) ;
8688
87- let button = await screen . findByRole ( "button" , { name : "Maybe " } ) ;
89+ let button = await screen . findByRole ( "button" , { name : "Vielleicht " } ) ;
8890 expect ( button . classList . contains ( "pf-m-secondary" ) ) . toBe ( true ) ;
8991
90- button = await screen . findByRole ( "button" , { name : "Sure " } ) ;
92+ button = await screen . findByRole ( "button" , { name : "Sicher " } ) ;
9193 expect ( button . classList . contains ( "pf-m-secondary" ) ) . toBe ( true ) ;
9294 } ) ;
9395 } ) ;
9496
9597 it ( "renders actions enabled or disabled according to given conditions" , async ( ) => {
9698 renderQuestionActions ( ) ;
9799
98- let button = await screen . findByRole ( "button" , { name : "No " } ) ;
100+ let button = await screen . findByRole ( "button" , { name : "Nein " } ) ;
99101 expect ( button ) . toHaveAttribute ( "disabled" ) ;
100102
101- button = await screen . findByRole ( "button" , { name : "Maybe " } ) ;
103+ button = await screen . findByRole ( "button" , { name : "Vielleicht " } ) ;
102104 expect ( button ) . not . toHaveAttribute ( "disabled" ) ;
103105 } ) ;
104106
105107 it ( "calls the actionCallback when user clicks on action" , async ( ) => {
106108 const { user } = renderQuestionActions ( ) ;
107109
108- const button = await screen . findByRole ( "button" , { name : "Sure " } ) ;
110+ const button = await screen . findByRole ( "button" , { name : "Sicher " } ) ;
109111 await user . click ( button ) ;
110112
111113 expect ( actionCallback ) . toHaveBeenCalled ( ) ;
0 commit comments