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

GN-56 Footer logo and remove IE8 support for SVG fallback #141

Merged
merged 2 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class Footer extends Component {
className={styles.logo}
aria-label="Go to NICE home page"
>
{typeof SVGRect !== "undefined" && <NiceLogo />}
<NiceLogo />
</TrackedLink>
<Services service={this.props.service} />
<Pages service={this.props.service} />
Expand Down
9 changes: 1 addition & 8 deletions src/Footer/Footer.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@ describe("Legal", () => {
expect(wrapper).toHaveLength(1);
});

it("Matches snapshot with no SVG support", () => {
it("Matches snapshot", () => {
const wrapper = shallow(<Footer service="cks" />);
expect(toJson(wrapper)).toMatchSnapshot();
});

it("Matches snapshot with SVG support", () => {
window.SVGRect = "anything";
const wrapper = shallow(<Footer service="cks" />);
expect(toJson(wrapper)).toMatchSnapshot();
delete window.SVGRect;
});
});
10 changes: 5 additions & 5 deletions src/Footer/Social/Social.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class Social extends Component {
eventAction={footerClickEventAction}
eventLabel="Facebook"
>
{typeof SVGRect !== "undefined" && <FacebookIcon />}
<FacebookIcon />
Facebook
</TrackedLink>
</li>
Expand All @@ -30,7 +30,7 @@ export default class Social extends Component {
eventAction={footerClickEventAction}
eventLabel="Twitter"
>
{typeof SVGRect !== "undefined" && <TwitterIcon />}
<TwitterIcon />
Twitter
</TrackedLink>
</li>
Expand All @@ -40,7 +40,7 @@ export default class Social extends Component {
eventAction={footerClickEventAction}
eventLabel="YouTube"
>
{typeof SVGRect !== "undefined" && <YouTubeIcon />}
<YouTubeIcon />
YouTube
</TrackedLink>
</li>
Expand All @@ -50,7 +50,7 @@ export default class Social extends Component {
eventAction={footerClickEventAction}
eventLabel="Instagram"
>
{typeof SVGRect !== "undefined" && <InstagramIcon />}
<InstagramIcon />
Instagram
</TrackedLink>
</li>
Expand All @@ -60,7 +60,7 @@ export default class Social extends Component {
eventAction={footerClickEventAction}
eventLabel="LinkedIn"
>
{typeof SVGRect !== "undefined" && <LinkedInIcon />}
<LinkedInIcon />
LinkedIn
</TrackedLink>
</li>
Expand Down
9 changes: 1 addition & 8 deletions src/Footer/Social/Social.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@ describe("Social", () => {
expect(wrapper).toHaveLength(1);
});

it("Matches snapshot with no SVG support", () => {
it("Matches snapshot", () => {
const wrapper = shallow(<Social />);
expect(toJson(wrapper)).toMatchSnapshot();
});

it("Matches snapshot with SVG support", () => {
window.SVGRect = "anything";
const wrapper = shallow(<Social />);
expect(toJson(wrapper)).toMatchSnapshot();
delete window.SVGRect;
});
});
64 changes: 1 addition & 63 deletions src/Footer/Social/__snapshots__/Social.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Social Matches snapshot with SVG support 1`] = `
exports[`Social Matches snapshot 1`] = `
<div
className="wrapper"
>
Expand Down Expand Up @@ -66,65 +66,3 @@ exports[`Social Matches snapshot with SVG support 1`] = `
</ul>
</div>
`;

exports[`Social Matches snapshot with no SVG support 1`] = `
<div
className="wrapper"
>
<ul
aria-label="NICE on social media"
className="list"
>
<li>
<TrackedLink
eventAction="Footer click"
eventCategory="TopHat and footer"
eventLabel="Facebook"
href="https://en-gb.facebook.com/NationalInstituteforHealthandCareExcellence/"
>
Facebook
</TrackedLink>
</li>
<li>
<TrackedLink
eventAction="Footer click"
eventCategory="TopHat and footer"
eventLabel="Twitter"
href="https://twitter.com/NICEcomms"
>
Twitter
</TrackedLink>
</li>
<li>
<TrackedLink
eventAction="Footer click"
eventCategory="TopHat and footer"
eventLabel="YouTube"
href="https://www.youtube.com/user/NICEmedia"
>
YouTube
</TrackedLink>
</li>
<li>
<TrackedLink
eventAction="Footer click"
eventCategory="TopHat and footer"
eventLabel="Instagram"
href="https://www.instagram.com/nicecomms/"
>
Instagram
</TrackedLink>
</li>
<li>
<TrackedLink
eventAction="Footer click"
eventCategory="TopHat and footer"
eventLabel="LinkedIn"
href="https://www.linkedin.com/company/national-institute-for-health-and-clinical-excellence"
>
LinkedIn
</TrackedLink>
</li>
</ul>
</div>
`;
29 changes: 1 addition & 28 deletions src/Footer/__snapshots__/Footer.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Legal Matches snapshot with SVG support 1`] = `
exports[`Legal Matches snapshot 1`] = `
<footer
className="footer"
>
Expand Down Expand Up @@ -28,30 +28,3 @@ exports[`Legal Matches snapshot with SVG support 1`] = `
<Legal />
</footer>
`;

exports[`Legal Matches snapshot with no SVG support 1`] = `
<footer
className="footer"
>
<div
className="container"
>
<TrackedLink
aria-label="Go to NICE home page"
className="logo"
eventAction="Footer click"
eventCategory="TopHat and footer"
eventLabel="Logo"
href="https://www.nice.org.uk/"
/>
<Services
service="cks"
/>
<Pages
service="cks"
/>
<Social />
</div>
<Legal />
</footer>
`;
9 changes: 1 addition & 8 deletions src/Header/Search/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,7 @@ export default class Search extends Component {
aria-label="Perform search"
onClick={this.searchSubmitHandler}
>
{!this.state.canUseDOM || typeof window.SVGRect !== "undefined" ? (
<SearchIcon className={styles.icon} />
) : (
// We can remove this fallback when we drop support for IE8
<span className={styles.icon} aria-hidden="true">
search
</span>
)}
<SearchIcon className={styles.icon} />
</button>
<SkipLink to={`#${this.props.skipLinkId}`}>Skip to content</SkipLink>
</form>
Expand Down
9 changes: 1 addition & 8 deletions src/Header/Search/Search.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,10 @@ describe("Search", () => {
expect(toJson(wrapper)).toMatchSnapshot();
});

it("Renders SVG search icon when in an SVG-compatible browser", () => {
window.SVGRect = {};
it("Renders SVG search icon", () => {
const wrapper = shallow(<Search {...defaultProps} />);
expect(wrapper.find("SvgSearch").length).toEqual(1);
expect(wrapper.find("SvgSearch").props()).toEqual({ className: "icon" });
window.SVGRect = undefined;
});

it("Renders fallback unicode search button text when in an non SVG-compatible browser", () => {
const wrapper = shallow(<Search {...defaultProps} />);
expect(wrapper.find("button").text()).toEqual("search");
});
});

Expand Down
7 changes: 2 additions & 5 deletions src/Header/Search/__snapshots__/Search.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ exports[`Search Rendering Matches snapshot 1`] = `
onClick={[Function]}
type="submit"
>
<span
aria-hidden="true"
<SvgSearch
className="icon"
>
search
</span>
/>
</button>
<SkipLink
to="#content-start"
Expand Down