-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Asl/4495 keeping animal alive (#928)
* Content updates for NTS fate of animals question (ref 1 in copy deck) and protocol fate of animals question (ref 2 in copy deck) * conditional render and hyperlink done. * conditional render on protocols and mapped nts - protocols correctly. * reverting change made in error. * applied eslint. * existing modal using it has no CSS. * dynaic checkbox text in the modal. * css styling applied, cancel button is dif from design. Clear functionality on subquestion todo. * Content updates for NTS fate of animals question (ref 1 in copy deck) and protocol fate of animals question (ref 2 in copy deck) * conditional render and hyperlink done. * conditional render on protocols and mapped nts - protocols correctly. * reverting change made in error. * applied eslint. * existing modal using it has no CSS. * dynaic checkbox text in the modal. * css styling applied, cancel button is dif from design. Clear functionality on subquestion todo. * apply css from stylesheet. * match design. * nts-modal work: successfully wrapped Checkbox component. * complete refactor of checkbox and modal to appear in NTS with CSS. React comp done. * eslint fix, existing test passing. * ASL-4495 complete. * ASL-4495 complete * Content updates for NTS fate of animals question (ref 1 in copy deck) and protocol fate of animals question (ref 2 in copy deck) * conditional render and hyperlink done. * conditional render on protocols and mapped nts - protocols correctly. * reverting change made in error. * applied eslint. * killing & use-in-other-project clearing nodes successfully. * test stub data fixed as redux state shows. * package-lock commit * cancel button CSS matched. * adding href to elimate WAG2.2 issue. * crawl over all avilable protocols and handle changes based on checkbox selection. * nts checkboxes to use special field set. * nts checkboxes to use special field set. * refactor method to be less expressive. * lint applied * use map over foreach as it safer approach. * version update in package.json * lock file commited so the pipleline reads the changes. * merge master * kept alive use not covered in checks. * fixed issue with protocol * bug fix on protocol review, fate-of-animal undefined. * Update protocols.js * refactor the code for readability. * markdown url to return url when client side, otherwise parm. * test added to mock window object and test if window is obj is null. to address client and server side rendering. * typo fixed. * ensure that else path also have options set to it. --------- Co-authored-by: edemirbag <[email protected]>
- Loading branch information
1 parent
6d581e7
commit 29777d3
Showing
5 changed files
with
66 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import assert from 'assert'; | ||
import {getCurrentURLForFateOfAnimals, UrlMarkdown} from '../../../client/helpers'; | ||
|
||
// Mock window object | ||
global.window = { | ||
location: { | ||
href: 'https://example.com/edit/some-page' | ||
} | ||
}; | ||
|
||
describe('getCurrentURLForFateOfAnimals', () => { | ||
it('should return the correct URL for fate-of-animals', () => { | ||
const expectedURL = 'https://example.com/edit/fate-of-animals'; | ||
const result = getCurrentURLForFateOfAnimals(); | ||
assert.strictEqual(result, expectedURL); | ||
}); | ||
|
||
it('should return null if window.location.href is not set', () => { | ||
// Mock the href to be null | ||
window.location.href = ''; | ||
const result = getCurrentURLForFateOfAnimals(); | ||
assert.strictEqual(result, null); | ||
}); | ||
}); | ||
|
||
describe('UrlMarkdown', () => { | ||
it('should return the anchor name with the correct URL markdown', () => { | ||
window.location.href = 'https://example.com/edit/some-page'; | ||
const anchoreName = 'Fate of Animals'; | ||
const expectedMarkdown = '[Fate of Animals](https://example.com/edit/fate-of-animals)'; | ||
const result = UrlMarkdown(anchoreName); | ||
assert.strictEqual(result, expectedMarkdown); | ||
}); | ||
|
||
it('should return the anchor name if URL is null', () => { | ||
// Mock the href to be null | ||
window.location.href = ''; | ||
const anchoreName = 'Fate of Animals'; | ||
const result = UrlMarkdown(anchoreName); | ||
assert.strictEqual(result, anchoreName); | ||
}); | ||
}); |