generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MWPW-158077 rollout new Timeline block #2926
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
064a8be
Move files out of mep folder
markpadbe a88101b
Update to match grid-width-10
markpadbe 3500537
Merge branch 'stage' into timelinerollout
markpadbe 799d652
Merge branch 'stage' into timelinerollout
markpadbe c1949f3
Remove from mep folder and add unit tests
markpadbe 7c6b093
Merge branch 'stage' into timelinerollout
markpadbe a4c9375
Add mock to test
markpadbe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion
2
libs/mep/mwpw-143159/timeline/timeline.js → libs/blocks/timeline/timeline.js
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,23 @@ | ||
<div class="timeline"> | ||
<div> | ||
<div data-valign="middle"> | ||
<p>linear-gradient(to right, #E63888 0, #E9749A 100%)</p> | ||
<h3 id="day-1">Day 1</h3> | ||
<p>If you start your free trial today | <strong>7-day free trial</strong></p> | ||
</div> | ||
</div> | ||
<div> | ||
<div data-valign="middle"> | ||
<p>#FFCE2E</p> | ||
<h3 id="day-8">Day 8</h3> | ||
<p>Your subscription starts and billing begins | <strong>14-day full refund period</strong></p> | ||
</div> | ||
</div> | ||
<div> | ||
<div data-valign="middle"> | ||
<h3 id="day-21">Day 21</h3> | ||
<p>Full refund period ends</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
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,25 @@ | ||
<html dir="rtl"> | ||
<div class="timeline"> | ||
<div> | ||
<div data-valign="middle"> | ||
<p>#FFCE2E</p> | ||
<h3 id="day-1">Day 1</h3> | ||
<p>If you start your free trial today | <strong>7-day free trial</strong></p> | ||
</div> | ||
</div> | ||
<div> | ||
<div data-valign="middle"> | ||
<p>linear-gradient(to right, #E63888 0, #E9749A 100%)</p> | ||
<h3 id="day-8">Day 8</h3> | ||
<p>Your subscription starts and billing begins | <strong>14-day full refund period</strong></p> | ||
</div> | ||
</div> | ||
<div> | ||
<div data-valign="middle"> | ||
<h3 id="day-21">Day 21</h3> | ||
<p>Full refund period ends</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</html> |
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,77 @@ | ||
import { readFile } from '@web/test-runner-commands'; | ||
import { expect } from '@esm-bundle/chai'; | ||
import { setConfig } from '../../../libs/utils/utils.js'; | ||
|
||
const config = { codeRoot: '/libs' }; | ||
setConfig(config); | ||
|
||
const { default: init } = await import('../../../libs/blocks/timeline/timeline.js'); | ||
|
||
describe('Timeline', () => { | ||
beforeEach(async () => { | ||
document.body.innerHTML = await readFile({ path: './mocks/body.html' }); | ||
}); | ||
|
||
afterEach(() => { | ||
document.body.innerHTML = ''; | ||
}); | ||
|
||
it('has 3 headers', async () => { | ||
const timelineEl = document.querySelector('.timeline'); | ||
init(timelineEl); | ||
const headers = timelineEl.querySelectorAll('.timeline h3'); | ||
expect(headers[0].textContent).to.equal('Day 1'); | ||
expect(headers[1].textContent).to.equal('Day 8'); | ||
expect(headers[2].textContent).to.equal('Day 21'); | ||
}); | ||
it('has 3 descriptions', async () => { | ||
const timelineEl = document.querySelector('.timeline'); | ||
init(timelineEl); | ||
const descriptions = timelineEl.querySelectorAll('.timeline h3 + p'); | ||
|
||
expect(descriptions[0].textContent).to.equal('If you start your free trial today'); | ||
expect(descriptions[1].textContent).to.equal('Your subscription starts and billing begins'); | ||
expect(descriptions[2].textContent).to.equal('Full refund period ends'); | ||
}); | ||
it('has a payment period and a refund period section ', async () => { | ||
const timelineEl = document.querySelector('.timeline'); | ||
init(timelineEl); | ||
const trialPeriod = timelineEl.querySelector('.row .left .period'); | ||
const refundPeriod = timelineEl.querySelector('.row .right .period'); | ||
|
||
expect(trialPeriod.textContent).to.equal('7-day free trial'); | ||
expect(refundPeriod.textContent).to.equal('14-day full refund period'); | ||
expect(trialPeriod.style.background.includes('to right')).to.true; | ||
}); | ||
it('it sets bar background colors based on colors in free trial and refund period section', async () => { | ||
const timelineEl = document.querySelector('.timeline'); | ||
init(timelineEl); | ||
const bars = timelineEl.querySelectorAll('.bar'); | ||
|
||
expect(bars[0].style.backgroundColor).to.equal('rgb(230, 56, 136)'); | ||
expect(bars[1].style.backgroundColor).to.equal('rgb(233, 116, 154)'); | ||
expect(bars[2].style.backgroundColor).to.equal('rgb(255, 206, 46)'); | ||
}); | ||
it('updates background linear gradient for rtl', async () => { | ||
const timelineEl = document.querySelector('.timeline'); | ||
timelineEl.parentElement.setAttribute('dir', 'rtl'); | ||
init(timelineEl); | ||
const trialPeriod = timelineEl.querySelector('.row .left .period'); | ||
expect(trialPeriod.style.background.includes('to left')).to.be.true; | ||
}); | ||
describe('Timeline', () => { | ||
beforeEach(async () => { | ||
document.body.innerHTML = await readFile({ path: './mocks/switchcolors.html' }); | ||
}); | ||
afterEach(() => { | ||
document.body.innerHTML = ''; | ||
}); | ||
it('handles linear-gradient for either side', async () => { | ||
const timelineEl = document.querySelector('.timeline'); | ||
init(timelineEl); | ||
const refundPeriod = timelineEl.querySelector('.row .right .period'); | ||
expect(refundPeriod.textContent).to.equal('14-day full refund period'); | ||
expect(refundPeriod.style.background.includes('to left')).to.true; | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious what the reason was to switch to 1120
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was part of a request for 10 col max width and mirrors what I see in the codebase for .section.grid-width-10