Skip to content

Commit

Permalink
Added test case for currentLanguage in translatePageEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindaviladev committed Aug 9, 2024
1 parent dce0789 commit 618fbcf
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,21 @@ describe('DotEmaShellComponent', () => {
expect(confirmationServiceSpy).not.toHaveBeenCalled();
});

it('should not trigger the confirmation service if the page dont have current language', () => {
spectator.triggerNavigation({
url: [],
queryParams: {
language_id: 3,
url: 'index',
'com.dotmarketing.persona.id': DEFAULT_PERSONA.identifier
}
});

spectator.detectChanges();

expect(confirmationServiceSpy).not.toHaveBeenCalled();
});

it("should trigger the confirmation service if the page isn't translated to the current language", fakeAsync(() => {
spectator.triggerNavigation({
url: [],
Expand Down
28 changes: 28 additions & 0 deletions core-web/libs/portlets/edit-ema/portlet/src/lib/shared/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,34 @@ export const PAGE_RESPONSE_BY_LANGUAGE_ID = {
template: {
drawed: true
}
}),

3: of({
page: {
title: 'hello world',
identifier: '123',
inode: '123',
canEdit: true,
canRead: true,
pageURI: 'index',
liveInode: '1234',
stInode: '12345',
live: true
},
viewAs: {
language: {
id: 3,
languageCode: 'ES',
countryCode: '',
language: 'Spanish',
country: 'Spain'
},
persona: DEFAULT_PERSONA
},
site: mockSites[0],
template: {
drawed: true
}
})
};

Expand Down

0 comments on commit 618fbcf

Please sign in to comment.