-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 13273-update-norwegian-version-of-gitea
- Loading branch information
Showing
13 changed files
with
168 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
frontend/packages/ux-editor/src/classes/FormLayoutSettings.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { FormLayoutSettings } from '@altinn/ux-editor/classes/FormLayoutSettings'; | ||
import { formLayoutSettingsMock } from '@altinn/ux-editor/testing/mocks'; | ||
import type { ILayoutSettings } from 'app-shared/types/global'; | ||
|
||
describe('FormLayoutSettings', () => { | ||
describe('getPdfLayoutName', () => { | ||
it('Should get pdfLayoutName as undefined from class when not set in object', () => { | ||
const layoutSettings = setupFormLayoutSettings({ | ||
pages: { ...formLayoutSettingsMock.pages, pdfLayoutName: undefined }, | ||
}); | ||
const pdfLayoutName = layoutSettings.getPdfLayoutName(); | ||
expect(pdfLayoutName).toBeUndefined(); | ||
}); | ||
|
||
it('Should get pdfLayoutName as defined from class when set in object', () => { | ||
const pdfLayoutNameMock = 'pdfLayoutNameMock'; | ||
const layoutSettings = setupFormLayoutSettings({ | ||
pages: { ...formLayoutSettingsMock.pages, pdfLayoutName: pdfLayoutNameMock }, | ||
}); | ||
const pdfLayoutName = layoutSettings.getPdfLayoutName(); | ||
expect(pdfLayoutName).toBe(pdfLayoutNameMock); | ||
}); | ||
}); | ||
describe('setPdfLayoutName', () => { | ||
it('Should set pdfLayoutName to new value when updated', () => { | ||
const pdfLayoutNameMock = 'pdfLayoutNameMock'; | ||
const layoutSettings = setupFormLayoutSettings({ | ||
pages: { ...formLayoutSettingsMock.pages, pdfLayoutName: undefined }, | ||
}); | ||
layoutSettings.setPdfLayoutName(pdfLayoutNameMock); | ||
expect(layoutSettings.getPdfLayoutName()).toBe(pdfLayoutNameMock); | ||
}); | ||
}); | ||
}); | ||
|
||
const setupFormLayoutSettings = ({ | ||
...props | ||
}: ILayoutSettings = formLayoutSettingsMock): FormLayoutSettings => { | ||
return new FormLayoutSettings({ ...props }); | ||
}; |
22 changes: 22 additions & 0 deletions
22
frontend/packages/ux-editor/src/classes/FormLayoutSettings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { ILayoutSettings } from 'app-shared/types/global'; | ||
|
||
export class FormLayoutSettings { | ||
private readonly layoutSettings: ILayoutSettings; | ||
|
||
constructor(layoutSettings: ILayoutSettings) { | ||
this.layoutSettings = layoutSettings; | ||
} | ||
|
||
public getLayoutSettings(): ILayoutSettings { | ||
return this.layoutSettings; | ||
} | ||
|
||
public setPdfLayoutName(layoutName: string): FormLayoutSettings { | ||
this.layoutSettings.pages.pdfLayoutName = layoutName; | ||
return this; | ||
} | ||
|
||
public getPdfLayoutName(): string { | ||
return this.layoutSettings.pages.pdfLayoutName; | ||
} | ||
} |
Oops, something went wrong.