Skip to content

Commit 00d3709

Browse files
authored
FE-1816 - Fixing getting-started-sparkpost links/media (#682)
* FE-1816 - Fix images loading and 2 of the # links in the top nav of the subpage
1 parent 0f56c5f commit 00d3709

File tree

8 files changed

+10210
-46
lines changed

8 files changed

+10210
-46
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ public/content
4444

4545
# Netlify
4646
/.netlify/
47+
48+
# Cypress
49+
cypress/screenshots
50+
51+
# nodenv - use 16.12.0
52+
.node-version

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ The following instructions walk you through how to sync your local version of th
151151

152152
_**This is not a required step in contributing to the documentation**_
153153

154+
### Node Version
155+
156+
16.12.0
157+
154158
### Installation
155159

156160
Navigate in your terminal to the root directory (`support-docs/` or whatever you named it) and install all dependencies:
@@ -169,6 +173,14 @@ npm run dev
169173

170174
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
171175

176+
### Local Cypress Tests
177+
178+
After setting your local node version, installing deps, and running `npm run start`:
179+
180+
```bash
181+
npm run test
182+
```
183+
172184
### Learn More About Next.js
173185

174186
To learn more about Next.js, take a look at the following resources:

components/markdown/image.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { Box } from '@sparkpost/matchbox';
55

66
const getImageSrc = (asPath: string, src?: string) => {
77
const environment = getWindow();
8-
const pathArr = asPath.split('/');
8+
// replace any trailing #page-link info from the end first, then split
9+
const pathArr = asPath.replace(/#.*$/g, '').split('/');
910

1011
// Check for 'trailing slash'
1112
if (!pathArr[pathArr.length - 1]) {

content/docs/getting-started/getting-started-sparkpost.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Note: SparkPost is available in multiple regions. "SparkPost" refers to the Spar
1414
* [Preparing Your "From:" Address](#preparing-your-from-address)
1515
* [Important: Coming From Other Email Services](#important-coming-from-other-email-services)
1616
* [Sending Email](#sending-email)
17-
* [Tracking Recipient Behavior](#tracking-recipient-behavior)
17+
* [Tracking Recipient Behavior](#tracking-analytics)
1818
* [Improving Reputation And Branding](#improving-reputation-and-branding)
19-
* [Signals Analytics and Tracking](#signals-analytics-and-tracking)
19+
* [Signals Analytics and Tracking](#signals-analytics)
2020
* [Where To Next?](#where-to-next)
2121
* [How To Get Help](#how-to-get-help)
2222

cypress/content/docs/billing/upgrading-your-account.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ description: 'This is to test images.'
66

77
In order to have a working test, you have to maintain the same directory path of the image or else the image build process won't work.
88

9+
### Testing Image
10+
911
Testing Image 1 without ./
1012

1113
![Billing plan selection without ./](media/upgrading-your-account/billing-page.png)

cypress/integration/subpage.spec.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,18 @@ describe('images', () => {
4747
});
4848
});
4949

50-
it('Should display without error with ./', () => {
50+
it('Should load urls with trailing / and build image paths correctly', () => {
5151
cy.visit('/docs/billing/upgrading-your-account/');
52-
cy.get('[alt="Plan upgrade form with ./"]').should(($img) => {
52+
cy.get('[alt="Billing plan selection without ./"]').should(($img) => {
53+
const img = $img.get(0) as HTMLImageElement;
54+
const width = img.naturalWidth;
55+
expect(width).to.be.greaterThan(0);
56+
});
57+
});
58+
59+
it('Should load urls with # links and build image paths correctly', () => {
60+
cy.visit('/docs/billing/upgrading-your-account/#testing-image');
61+
cy.get('[alt="Billing plan selection without ./"]').should(($img) => {
5362
const img = $img.get(0) as HTMLImageElement;
5463
const width = img.naturalWidth;
5564
expect(width).to.be.greaterThan(0);

0 commit comments

Comments
 (0)