Skip to content

Commit

Permalink
Merge pull request #42 from Financial-Times/fix/CI-1517-deep-landscape
Browse files Browse the repository at this point in the history
fix backgroundColour set for deep-landscape
  • Loading branch information
juanSanchezAlcala authored Mar 7, 2023
2 parents 253979b + 01b2437 commit 6d963a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/get-topper-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ const useEditoriallySelectedTopper = (content) => {
content.topper.backgroundBox === 'light' ? 'white' : 'black';
} else if (!hasDarkBackground(content.topper.backgroundColour)) {
backgroundColour = 'white';
} else {
backgroundColour = 'black';
}
} else if (
content.topper.backgroundColour === 'pink' ||
Expand Down
15 changes: 15 additions & 0 deletions test/lib/get-topper-settings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,21 @@ describe('Get topper settings', () => {
expect(topper.backgroundColour).to.equal('white');
});

it('sets the `backgroundColour` to `black` if layout is deep landscape and background is dark', () => {
const topper = getTopperSettings({
topper: { layout: 'deep-landscape', backgroundColour: 'slate' }
});

expect(topper.backgroundColour).to.equal('black');
});
it('sets the `backgroundColour` to `white` if layout is deep landscape and background is undefined', () => {
const topper = getTopperSettings({
topper: { layout: 'deep-landscape' }
});

expect(topper.backgroundColour).to.equal('white');
});

describe('When a background Box is present', () => {
it('sets the `backgroundColour` to `white` if layout is deep landscape and background Box is light', () => {
const topper = getTopperSettings({
Expand Down

0 comments on commit 6d963a3

Please sign in to comment.