diff --git a/src/Domain/Membership/MembershipApplicationConfirmationData.ts b/src/Domain/Membership/MembershipApplicationConfirmationData.ts index 22d802a42..d9bd40cb3 100644 --- a/src/Domain/Membership/MembershipApplicationConfirmationData.ts +++ b/src/Domain/Membership/MembershipApplicationConfirmationData.ts @@ -11,4 +11,5 @@ export interface MembershipApplicationConfirmationData { membershipApplication: MembershipApplication; address: MembershipAddress; countries: Country[]; + tracking?: string; } diff --git a/src/components/pages/MembershipConfirmation.vue b/src/components/pages/MembershipConfirmation.vue index 151a2ec34..6cc4085c0 100644 --- a/src/components/pages/MembershipConfirmation.vue +++ b/src/components/pages/MembershipConfirmation.vue @@ -23,11 +23,17 @@

{{ address.email }}

+ + diff --git a/tests/unit/components/pages/MembershipConfirmation.spec.ts b/tests/unit/components/pages/MembershipConfirmation.spec.ts index 69942d8f2..b7ee796db 100644 --- a/tests/unit/components/pages/MembershipConfirmation.spec.ts +++ b/tests/unit/components/pages/MembershipConfirmation.spec.ts @@ -45,7 +45,8 @@ const yearlyApplication: MembershipApplication = { }; describe( 'MembershipConfirmation.vue', () => { - const getWrapper = ( membershipApplication: MembershipApplication, address: MembershipAddress ) => { + const getWrapper = ( membershipApplication: MembershipApplication, address: MembershipAddress, translationMock?: ( key: string, params?: Object ) => string ) => { + const translateFn = translationMock === undefined ? ( key: string, params?: Object ) => JSON.stringify( [ key, params ] ) : translationMock; const confirmationData: MembershipApplicationConfirmationData = { piwik: { membershipApplicationConfirmationGoalId: 123, @@ -63,7 +64,7 @@ describe( 'MembershipConfirmation.vue', () => { }, global: { mocks: { - $t: ( key: string, params?: Object ) => JSON.stringify( [ key, params ] ), + $t: translateFn, $n: ( amount: string ) => amount, }, }, @@ -126,4 +127,30 @@ describe( 'MembershipConfirmation.vue', () => { expect( wrapper.text() ).toContain( 'membership_confirmation_success_text_bank_transfer' ); } ); + test( 'shows the survey tile if survey link language item is not empty', () => { + const translateMock = ( key: string ): string => { + if ( key === 'membership_confirmation_survey_link' ) { + return 'https://example.com/survey'; + } + + return key; + }; + const wrapper = getWrapper( yearlyApplication, privateAddress, translateMock ); + + expect( wrapper.find( '.membership-survey' ).exists() ).toBeTruthy(); + } ); + + test( 'hides the survey tile if survey link language item is blank', () => { + const translateMock = ( key: string ): string => { + if ( key === 'membership_confirmation_survey_link' ) { + return ''; + } + + return key; + }; + const wrapper = getWrapper( yearlyApplication, privateAddress, translateMock ); + + expect( wrapper.find( '.membership-survey' ).exists() ).toBeFalsy(); + } ); + } );