Skip to content

Commit d64296f

Browse files
committed
Merge branch 'latest' of https://github.com/bbc/simorgh into Cypress-tests-transliteration-script-switching
2 parents 04591b6 + f5de20e commit d64296f

File tree

592 files changed

+1708
-65768
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

592 files changed

+1708
-65768
lines changed

.codeclimate.yml

-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ exclude_patterns:
1818
- 'scripts/lighthouseBudget.js'
1919
- 'scripts/dependencyCheck.js'
2020
- 'scripts/simorghPages.js'
21-
- 'scripts/simorghLaunchDates.js'

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ NB there is further documentation colocated with relevant code. The above list i
3434

3535
A request to a BBC article (https://www.bbc.co.uk/news/articles/clldg965yzjo) is passed on to the Simorgh application from a proprietary routing and caching service (called Mozart).
3636

37-
The request matches a route in our express server using a regex match (`articleRegexPath` || `frontPageRegexPath`). If the URL matches the pre-defined regex pattern for an article or a front page we fetch some params from the route using the `getRouteProps` function. This returns the service, isAmp, route and match properties. Route is a react-router route that defines a method to fetch the initial JSON used to render the page and the react container in which to render i.e. `ArticleContainer`, this is typically called `getInitialData`
37+
The request matches a route in our express server using a regex match (`articleRegexPath`). If the URL matches the pre-defined regex pattern for an article or a front page we fetch some params from the route using the `getRouteProps` function. This returns the service, isAmp, route and match properties. Route is a react-router route that defines a method to fetch the initial JSON used to render the page and the react container in which to render i.e. `ArticleContainer`, this is typically called `getInitialData`
3838

3939
Once data is returned we pull the status code and pass all of this data as props to our main document using `renderDocument`.
4040

@@ -77,17 +77,17 @@ The withContexts HOC is a wrapper that provides access to the different context
7777

7878
#### withPageWrapper
7979

80-
The page wrapper HOC simply wraps the Article or FrontPage containers with a layout, at present we only have a single page layout. This layout includes the header, footer and context providers rendering the main body as a child between the header and the footer.
80+
The page wrapper HOC simply wraps the Article containers with a layout, at present we only have a single page layout. This layout includes the header, footer and context providers rendering the main body as a child between the header and the footer.
8181

8282
#### withError
8383

84-
The error HOC checks the error prop passed in, if error is set to null the Article or FrontPage container is simply returned.
84+
The error HOC checks the error prop passed in, if error is set to null the Article container is simply returned.
8585

8686
If error is set to true the Error component is returned, giving the user a visual indication of the error e.g. a 500 error page.
8787

8888
#### withData
8989

90-
Assuming the other HOC's have returned the original Article or FrontPage container the data HOC will run some validation checks on the JSON data passed in via the data prop. If all of the checks are satisfied the ArticleContainer will be returned with a single `pageData` prop. This pageData props will house the JSON data to be rendered e.g. the Optimo blocks for a given article.
90+
Assuming the other HOC's have returned the original Article container the data HOC will run some validation checks on the JSON data passed in via the data prop. If all of the checks are satisfied the ArticleContainer will be returned with a single `pageData` prop. This pageData props will house the JSON data to be rendered e.g. the Optimo blocks for a given article.
9191

9292
#### withHashChangeHandler
9393

@@ -100,6 +100,7 @@ The withOptimizelyProvider HOC returns components that have been enhanced with a
100100
withOptimizelyProvider should be added as the value of the `handlerBeforeContexts` object key within [applyBasicPageHandlers.js](https://github.com/bbc/simorgh/tree/latest/src/app/pages/utils/applyBasicPageHandlers.js#L8), as the `ckns_mvt` is [set within the UserContext](https://github.com/bbc/simorgh/tree/latest/src/app/contexts/UserContext/index.tsx#L33), so the `withOptimizelyProvider` HOC needs to be applied in the correct order alongside the [withContexts](https://github.com/bbc/simorgh/tree/latest/src/app/pages/utils/applyBasicPageHandlers.js#L13) HOC. This makes the `ckns_mvt` available on first time visits to pass into the `OptimizelyProvider`, along with attributes such as `service`, which is used for determining when Optimizely should enable an experiment.
101101

102102
Example for Article page:
103+
103104
```jsx
104105
import withOptimizelyProvider from '#app/legacy/containers/PageHandlers/withOptimizelyProvider';
105106
import ArticlePage from './ArticlePage';
@@ -108,7 +109,6 @@ import applyBasicPageHandlers from '../utils/applyBasicPageHandlers';
108109
export default applyBasicPageHandlers(ArticlePage, {
109110
handlerBeforeContexts: withOptimizelyProvider,
110111
});
111-
112112
```
113113

114114
### Adding a new Page type
@@ -118,7 +118,7 @@ When adding a new page type there are several parts required.
118118
#### 1) Fixture data should be added to `/data/{{service}}/{{pageType}}/`
119119

120120
- This should be done for each service using the page type.
121-
- [Fixture data example](https://github.com/bbc/simorgh/blob/5de59c6207d46b11c3af68c58a620e250aff3a1a/data/igbo/frontpage/index.json)
121+
- [Fixture data example](https://github.com/bbc/simorgh/blob/latest/data/igbo/articles)
122122

123123
#### 2) Serving the fixture data on local development
124124

@@ -129,7 +129,7 @@ When adding a new page type there are several parts required.
129129

130130
#### 3) Create a new container for the page type
131131

132-
- Similar to [this](https://github.com/bbc/simorgh/blob/latest/src/app/pages/FrontPage/index.jsx) we require a top level container that will act as the entry point for the page routing. Each page type should have its own container.
132+
- Similar to [this](https://github.com/bbc/simorgh/blob/latest/src/app/pages/ArticlePage/index.jsx) we require a top level container that will act as the entry point for the page routing. Each page type should have its own container.
133133
- The container should render a `main` element with a [`flex-grow: 1;` css declaration](https://github.com/bbc/simorgh/blob/8e19f820ec0de4abd18a4d13e62dd5d843a064c0/src/app/containers/ArticleMain/index.jsx#L39), this is to ensure it grows to fill the space between the visual header and footer, the [root div](https://github.com/bbc/simorgh/blob/8e19f820ec0de4abd18a4d13e62dd5d843a064c0/src/server/Document/component.jsx#L31) using a [flexbox 'sticky footer' implementation](https://developer.mozilla.org/en-US/docs/Web/CSS/Layout_cookbook/Sticky_footers#Alternate_method).
134134

135135
#### 4) Add new pre-processing rules if required.

a11y.js

-14
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,7 @@ const mediaEmbedErrorsToSuppress = [
4646
"Button has no text: //div[@id='p_audioui_container']/div[4]/button",
4747
];
4848

49-
const advertisementErrorsToSuppress = [
50-
// Principles: All documents must have a W3C recommended doctype
51-
// Editorial: Indicating language: Html must have lang attribute
52-
'/iframe',
53-
54-
// Design: Content resizing: Text must be styled with units that are resizable in all browsers
55-
"//div[@id='dotcom-leaderboard']/div/div[1]/a",
56-
"//div[@id='dotcom-mpu']/div/div[1]/a",
57-
];
58-
5949
const pageTypes = {
60-
frontPage: [
61-
"//div[@id='root']/header/nav/div/div[1]/div/ul",
62-
...advertisementErrorsToSuppress,
63-
],
6450
articles: ["//div[@id='root']/header/nav/div/div[1]/div/ul"],
6551
liveRadio: [
6652
...mediaEmbedErrorsToSuppress,

cypress/e2e/pages/frontPage/index.cy.js

-13
This file was deleted.

cypress/e2e/pages/frontPage/tests.js

-58
This file was deleted.

cypress/e2e/pages/frontPage/testsForAMPOnly.js

-17
This file was deleted.

cypress/e2e/pages/frontPage/testsForCanonicalOnly.js

-46
This file was deleted.

0 commit comments

Comments
 (0)