Skip to content
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

🐛 [Story attachment] Fix cta-image=none showing link icon #38109

Merged
merged 24 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6aabe91
Added tasts
mszylkowski Dec 21, 2021
dc1fa87
Undo
mszylkowski Dec 21, 2021
d707e5b
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Dec 28, 2021
0e3df75
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Dec 28, 2021
a3f7bd0
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Jan 4, 2022
8c5119c
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Jan 6, 2022
77f8435
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Jan 10, 2022
16e712e
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Jan 19, 2022
8088eb7
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Jan 25, 2022
3858b2a
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Jan 28, 2022
e12d2f6
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Jan 31, 2022
2a29105
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Feb 1, 2022
a5b781f
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Feb 10, 2022
b8006ee
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Mar 8, 2022
b570e86
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Mar 10, 2022
6b7e456
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Mar 22, 2022
50bdff8
Merge branch 'ampproject:main' into main
mszylkowski Mar 24, 2022
267ae0e
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Mar 29, 2022
c7edd8c
Merge branch 'main' of github.com:mszylkowski/amphtml
mszylkowski Mar 29, 2022
9842a23
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Mar 29, 2022
83e25bb
Merge branch 'main' of github.com:ampproject/amphtml
mszylkowski Apr 4, 2022
9ded8f1
Merge branch 'main' of github.com:mszylkowski/amphtml; branch 'main' …
mszylkowski Apr 5, 2022
4f7b975
Merge branch 'ampproject:main' into main
mszylkowski Apr 6, 2022
aae7a90
Fixed icon showing when cta-image=none, added tests
mszylkowski Apr 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const renderOutlinkUI = (pageEl, attachmentEl) => {
class="i-amphtml-story-outlink-page-attachment-img"
style={{backgroundImage: `url(${openImgAttr}) !important`}}
></div>
) : (
) : openImgAttr ? null : (
renderOutlinkLinkIconElement()
)}
<span class="i-amphtml-story-page-attachment-label">{openLabel}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,32 @@ describes.realWin(

expect(openAttachmentLabelEl.textContent).to.equal('CTA text');
});

it('should build the open attachment UI with link icon', async () => {
outlinkEl.setAttribute('layout', 'nodisplay');
outlinkEl.setAttribute('cta-text', 'Outlink with icon');

await outlink.buildCallback();
await outlink.layoutCallback();

const openAttachmentLinkIcon = page.querySelector(
'.i-amphtml-story-page-open-attachment .i-amphtml-story-page-open-attachment-link-icon'
);
expect(openAttachmentLinkIcon).to.exist;
});

it('should build the open attachment UI with no icon if cta-image=none', async () => {
outlinkEl.setAttribute('layout', 'nodisplay');
outlinkEl.setAttribute('cta-text', 'Outlink without icon');
outlinkEl.setAttribute('cta-image', 'none');

await outlink.buildCallback();
await outlink.layoutCallback();

const openAttachmentLinkIcon = page.querySelector(
'.i-amphtml-story-page-open-attachment .i-amphtml-story-page-open-attachment-link-icon'
);
expect(openAttachmentLinkIcon).to.not.exist;
});
}
);