@newskit-render/core 3.0.1-alpha.1 → 3.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,6 +17,7 @@ parameters:
|
|
|
17
17
|
orbs:
|
|
18
18
|
slack: circleci/slack@3.4.2
|
|
19
19
|
browser-tools: circleci/browser-tools@1.3.0
|
|
20
|
+
release-api: nukengprod/release-api@0.5.8
|
|
20
21
|
|
|
21
22
|
executors:
|
|
22
23
|
helm:
|
|
@@ -802,6 +803,16 @@ workflows:
|
|
|
802
803
|
name: install_deps
|
|
803
804
|
context: <% PROJECT_NAME >-dev
|
|
804
805
|
<<: *only_on_pr_branch
|
|
806
|
+
- lint:
|
|
807
|
+
<<: *only_on_pr_branch
|
|
808
|
+
context: <% PROJECT_NAME >-dev
|
|
809
|
+
requires:
|
|
810
|
+
- install_deps
|
|
811
|
+
- test_unit:
|
|
812
|
+
<<: *only_on_pr_branch
|
|
813
|
+
context: <% PROJECT_NAME >-dev
|
|
814
|
+
requires:
|
|
815
|
+
- install_deps
|
|
805
816
|
- e2e_test:
|
|
806
817
|
<<: *only_on_pr_branch
|
|
807
818
|
context: <% PROJECT_NAME >-dev
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0-alpha.1",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"@emotion/react": "11.9.3",
|
|
41
41
|
"@emotion/styled": "11.9.3",
|
|
42
42
|
"@newskit-render/api": "^1.6.7-alpha.0",
|
|
43
|
-
"@newskit-render/auth": "^1.3.11-alpha.
|
|
44
|
-
"@newskit-render/checkout": "^2.5.5-alpha.
|
|
43
|
+
"@newskit-render/auth": "^1.3.11-alpha.1",
|
|
44
|
+
"@newskit-render/checkout": "^2.5.5-alpha.1",
|
|
45
45
|
"@newskit-render/feature-flags": "^1.4.11",
|
|
46
46
|
"@newskit-render/feed": "^1.4.17-alpha.0",
|
|
47
|
-
"@newskit-render/my-account": "^5.0.1-alpha.
|
|
48
|
-
"@newskit-render/shared-components": "^2.6.
|
|
49
|
-
"@newskit-render/standalone-components": "^2.6.2-alpha.
|
|
47
|
+
"@newskit-render/my-account": "^5.0.1-alpha.2",
|
|
48
|
+
"@newskit-render/shared-components": "^2.6.2-alpha.0",
|
|
49
|
+
"@newskit-render/standalone-components": "^2.6.2-alpha.1",
|
|
50
50
|
"@newskit-render/validation": "^1.6.0",
|
|
51
51
|
"@next/font": "13.1.6",
|
|
52
52
|
"cross-fetch": "3.1.5",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from 'react-dom'
|
|
3
|
+
import { act } from 'react-dom/test-utils'
|
|
4
|
+
import { sharedTheme, sharedThemeDark } from '@newskit-render/shared-components'
|
|
5
|
+
import { AppContextProvider, AppContext } from '.'
|
|
6
|
+
|
|
7
|
+
const container = document.createElement('div')
|
|
8
|
+
document.body.appendChild(container)
|
|
9
|
+
|
|
10
|
+
describe('AppContext tests', () => {
|
|
11
|
+
test('renders the content with the default theme', () => {
|
|
12
|
+
render(
|
|
13
|
+
<AppContextProvider>
|
|
14
|
+
<AppContext.Consumer>
|
|
15
|
+
{({ theme }) => <div>{JSON.stringify(theme)}</div>}
|
|
16
|
+
</AppContext.Consumer>
|
|
17
|
+
</AppContextProvider>,
|
|
18
|
+
container
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
expect(container.textContent).toBe(JSON.stringify(sharedTheme))
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('setTheme should switch the theme', () => {
|
|
25
|
+
render(
|
|
26
|
+
<AppContextProvider>
|
|
27
|
+
<AppContext.Consumer>
|
|
28
|
+
{({ theme, setTheme }) => (
|
|
29
|
+
<div>
|
|
30
|
+
<button
|
|
31
|
+
type="button"
|
|
32
|
+
aria-label="btn"
|
|
33
|
+
data-testid="button"
|
|
34
|
+
onClick={(_) => setTheme(sharedThemeDark)}
|
|
35
|
+
/>
|
|
36
|
+
{JSON.stringify(theme)}
|
|
37
|
+
</div>
|
|
38
|
+
)}
|
|
39
|
+
</AppContext.Consumer>
|
|
40
|
+
</AppContextProvider>,
|
|
41
|
+
container
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
const button = document.querySelector('[data-testid=button]')
|
|
45
|
+
act(() => {
|
|
46
|
+
button?.dispatchEvent(new MouseEvent('click', { bubbles: true }))
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
expect(container.textContent).toBe(JSON.stringify(sharedThemeDark))
|
|
50
|
+
})
|
|
51
|
+
})
|