mirror of
https://github.com/HackPlan/polaris-react.git
synced 2026-04-29 09:45:39 +08:00
[AppProvider] Add testing examples and documentation (#1556)
* Added testing examples and documentation to AppProvider * Updated Polaris to v2.2.0
This commit is contained in:
committed by
GitHub
parent
7826232ceb
commit
3e64c439b8
@@ -3,7 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@shopify/polaris": "^2.0.0",
|
||||
"@shopify/polaris": "^2.2.0",
|
||||
"react": "^16.3.1",
|
||||
"react-dom": "^16.3.1",
|
||||
"react-scripts": "1.1.4"
|
||||
@@ -13,5 +13,9 @@
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test --env=jsdom",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"devDependencies": {
|
||||
"enzyme": "^3.3.0",
|
||||
"enzyme-adapter-react-16": "^1.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
AccountConnection,
|
||||
ChoiceList,
|
||||
SettingToggle,
|
||||
AppProvider,
|
||||
} from '@shopify/polaris';
|
||||
|
||||
class App extends Component {
|
||||
@@ -40,86 +39,84 @@ class App extends Component {
|
||||
];
|
||||
|
||||
return (
|
||||
<AppProvider>
|
||||
<Page
|
||||
title="Polaris"
|
||||
breadcrumbs={breadcrumbs}
|
||||
primaryAction={primaryAction}
|
||||
secondaryActions={secondaryActions}
|
||||
>
|
||||
<Layout>
|
||||
<Layout.AnnotatedSection
|
||||
title="Style"
|
||||
description="Customize the style of your checkout"
|
||||
<Page
|
||||
title="Polaris"
|
||||
breadcrumbs={breadcrumbs}
|
||||
primaryAction={primaryAction}
|
||||
secondaryActions={secondaryActions}
|
||||
>
|
||||
<Layout>
|
||||
<Layout.AnnotatedSection
|
||||
title="Style"
|
||||
description="Customize the style of your checkout"
|
||||
>
|
||||
<SettingToggle
|
||||
action={{
|
||||
content: 'Customize Checkout',
|
||||
}}
|
||||
>
|
||||
<SettingToggle
|
||||
action={{
|
||||
content: 'Customize Checkout',
|
||||
}}
|
||||
>
|
||||
Upload your store’s logo, change colors and fonts, and more.
|
||||
</SettingToggle>
|
||||
</Layout.AnnotatedSection>
|
||||
Upload your store’s logo, change colors and fonts, and more.
|
||||
</SettingToggle>
|
||||
</Layout.AnnotatedSection>
|
||||
|
||||
{this.renderAccount()}
|
||||
|
||||
<Layout.AnnotatedSection
|
||||
title="Form"
|
||||
description="A sample form using Polaris components."
|
||||
>
|
||||
<Card sectioned>
|
||||
<FormLayout>
|
||||
<FormLayout.Group>
|
||||
<TextField
|
||||
value={this.state.first}
|
||||
label="First Name"
|
||||
placeholder="Tom"
|
||||
onChange={this.valueUpdater('first')}
|
||||
/>
|
||||
<TextField
|
||||
value={this.state.last}
|
||||
label="Last Name"
|
||||
placeholder="Ford"
|
||||
onChange={this.valueUpdater('last')}
|
||||
/>
|
||||
</FormLayout.Group>
|
||||
{this.renderAccount()}
|
||||
|
||||
<Layout.AnnotatedSection
|
||||
title="Form"
|
||||
description="A sample form using Polaris components."
|
||||
>
|
||||
<Card sectioned>
|
||||
<FormLayout>
|
||||
<FormLayout.Group>
|
||||
<TextField
|
||||
value={this.state.email}
|
||||
label="Email"
|
||||
placeholder="example@email.com"
|
||||
onChange={this.valueUpdater('email')}
|
||||
value={this.state.first}
|
||||
label="First Name"
|
||||
placeholder="Tom"
|
||||
onChange={this.valueUpdater('first')}
|
||||
/>
|
||||
|
||||
<TextField
|
||||
multiline
|
||||
label="How did you hear about us?"
|
||||
placeholder="Website, ads, email, etc."
|
||||
value={this.state.autoGrow}
|
||||
onChange={this.valueUpdater('autoGrow')}
|
||||
value={this.state.last}
|
||||
label="Last Name"
|
||||
placeholder="Ford"
|
||||
onChange={this.valueUpdater('last')}
|
||||
/>
|
||||
</FormLayout.Group>
|
||||
|
||||
<ChoiceList
|
||||
allowMultiple
|
||||
choices={choiceListItems}
|
||||
selected={this.state.checkboxes}
|
||||
onChange={this.valueUpdater('checkboxes')}
|
||||
/>
|
||||
<TextField
|
||||
value={this.state.email}
|
||||
label="Email"
|
||||
placeholder="example@email.com"
|
||||
onChange={this.valueUpdater('email')}
|
||||
/>
|
||||
|
||||
<Button primary>Submit</Button>
|
||||
</FormLayout>
|
||||
</Card>
|
||||
</Layout.AnnotatedSection>
|
||||
<TextField
|
||||
multiline
|
||||
label="How did you hear about us?"
|
||||
placeholder="Website, ads, email, etc."
|
||||
value={this.state.autoGrow}
|
||||
onChange={this.valueUpdater('autoGrow')}
|
||||
/>
|
||||
|
||||
<Layout.Section>
|
||||
<FooterHelp>
|
||||
For more details on Polaris, visit our{' '}
|
||||
<Link url="https://polaris.shopify.com">styleguide</Link>.
|
||||
</FooterHelp>
|
||||
</Layout.Section>
|
||||
</Layout>
|
||||
</Page>
|
||||
</AppProvider>
|
||||
<ChoiceList
|
||||
allowMultiple
|
||||
choices={choiceListItems}
|
||||
selected={this.state.checkboxes}
|
||||
onChange={this.valueUpdater('checkboxes')}
|
||||
/>
|
||||
|
||||
<Button primary>Submit</Button>
|
||||
</FormLayout>
|
||||
</Card>
|
||||
</Layout.AnnotatedSection>
|
||||
|
||||
<Layout.Section>
|
||||
<FooterHelp>
|
||||
For more details on Polaris, visit our{' '}
|
||||
<Link url="https://polaris.shopify.com">style guide</Link>.
|
||||
</FooterHelp>
|
||||
</Layout.Section>
|
||||
</Layout>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<App />, div);
|
||||
ReactDOM.unmountComponentAtNode(div);
|
||||
});
|
||||
@@ -1,9 +1,13 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
import '@shopify/polaris/styles.css';
|
||||
import {AppProvider} from '@shopify/polaris';
|
||||
|
||||
import App from './App';
|
||||
|
||||
ReactDOM.render(
|
||||
<App />,
|
||||
document.getElementById('root')
|
||||
<AppProvider>
|
||||
<App />
|
||||
</AppProvider>,
|
||||
document.getElementById('root'),
|
||||
);
|
||||
|
||||
4
examples/create-react-app/src/setupTests.js
Normal file
4
examples/create-react-app/src/setupTests.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import Enzyme from 'enzyme';
|
||||
import Adapter from 'enzyme-adapter-react-16';
|
||||
|
||||
Enzyme.configure({adapter: new Adapter()});
|
||||
12
examples/create-react-app/src/tests/App.test.js
Normal file
12
examples/create-react-app/src/tests/App.test.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
import {Page} from '@shopify/polaris';
|
||||
|
||||
import App from '../App';
|
||||
|
||||
import {mountWithAppProvider} from './utils/enzyme';
|
||||
|
||||
// Sample test to demonstrate how you should test with AppProvider context
|
||||
it('renders page', () => {
|
||||
const wrapper = mountWithAppProvider(<App />);
|
||||
expect(wrapper.find(Page).exists()).toBe(true);
|
||||
});
|
||||
24
examples/create-react-app/src/tests/utils/enzyme.js
Normal file
24
examples/create-react-app/src/tests/utils/enzyme.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import merge from 'lodash/merge';
|
||||
import {shallow, mount} from 'enzyme';
|
||||
import {createPolarisContext, polarisContextTypes} from '@shopify/polaris';
|
||||
|
||||
function mergeAppProviderOptions(options) {
|
||||
const context = createPolarisContext();
|
||||
|
||||
return merge(
|
||||
{},
|
||||
{
|
||||
context,
|
||||
childContextTypes: polarisContextTypes,
|
||||
},
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
export function mountWithAppProvider(node, options) {
|
||||
return mount(node, mergeAppProviderOptions(options));
|
||||
}
|
||||
|
||||
export function shallowWithAppProvider(node, options) {
|
||||
return shallow(node, mergeAppProviderOptions(options)).dive(options);
|
||||
}
|
||||
@@ -15,9 +15,9 @@
|
||||
lodash "^4.17.4"
|
||||
lodash-decorators "^4.3.5"
|
||||
|
||||
"@shopify/polaris@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@shopify/polaris/-/polaris-2.0.0.tgz#a40131535076a12607708360871ecae5de1b64ce"
|
||||
"@shopify/polaris@^2.1.0":
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@shopify/polaris/-/polaris-2.2.0.tgz#f781cb4bc4b55268124e4df1f6e1eef2a18b4f99"
|
||||
dependencies:
|
||||
"@shopify/images" "^1.1.0"
|
||||
"@shopify/javascript-utilities" "^2.1.0"
|
||||
@@ -1386,6 +1386,17 @@ chardet@^0.4.0:
|
||||
version "0.4.2"
|
||||
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
|
||||
|
||||
cheerio@^1.0.0-rc.2:
|
||||
version "1.0.0-rc.2"
|
||||
resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.2.tgz#4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db"
|
||||
dependencies:
|
||||
css-select "~1.2.0"
|
||||
dom-serializer "~0.1.0"
|
||||
entities "~1.1.1"
|
||||
htmlparser2 "^3.9.1"
|
||||
lodash "^4.15.0"
|
||||
parse5 "^3.0.1"
|
||||
|
||||
chokidar@^1.6.0, chokidar@^1.7.0:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468"
|
||||
@@ -1512,6 +1523,10 @@ colormin@^1.0.5:
|
||||
css-color-names "0.0.4"
|
||||
has "^1.0.1"
|
||||
|
||||
colors@0.5.x:
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/colors/-/colors-0.5.1.tgz#7d0023eaeb154e8ee9fce75dcb923d0ed1667774"
|
||||
|
||||
colors@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63"
|
||||
@@ -1737,7 +1752,7 @@ css-loader@0.28.7:
|
||||
postcss-value-parser "^3.3.0"
|
||||
source-list-map "^2.0.0"
|
||||
|
||||
css-select@^1.1.0:
|
||||
css-select@^1.1.0, css-select@~1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858"
|
||||
dependencies:
|
||||
@@ -1974,6 +1989,10 @@ diffie-hellman@^5.0.0:
|
||||
miller-rabin "^4.0.0"
|
||||
randombytes "^2.0.0"
|
||||
|
||||
discontinuous-range@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/discontinuous-range/-/discontinuous-range-1.0.0.tgz#e38331f0844bba49b9a9cb71c771585aab1bc65a"
|
||||
|
||||
dns-equal@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d"
|
||||
@@ -2014,7 +2033,7 @@ dom-helpers@^3.3.1:
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.3.1.tgz#fc1a4e15ffdf60ddde03a480a9c0fece821dd4a6"
|
||||
|
||||
dom-serializer@0:
|
||||
dom-serializer@0, dom-serializer@~0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82"
|
||||
dependencies:
|
||||
@@ -2031,7 +2050,7 @@ domain-browser@^1.1.1:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda"
|
||||
|
||||
domelementtype@1:
|
||||
domelementtype@1, domelementtype@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2"
|
||||
|
||||
@@ -2045,6 +2064,12 @@ domhandler@2.1:
|
||||
dependencies:
|
||||
domelementtype "1"
|
||||
|
||||
domhandler@^2.3.0:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803"
|
||||
dependencies:
|
||||
domelementtype "1"
|
||||
|
||||
domutils@1.1:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.1.6.tgz#bddc3de099b9a2efacc51c623f28f416ecc57485"
|
||||
@@ -2058,6 +2083,13 @@ domutils@1.5.1:
|
||||
dom-serializer "0"
|
||||
domelementtype "1"
|
||||
|
||||
domutils@^1.5.1:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a"
|
||||
dependencies:
|
||||
dom-serializer "0"
|
||||
domelementtype "1"
|
||||
|
||||
dot-prop@^4.1.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57"
|
||||
@@ -2133,10 +2165,61 @@ enhanced-resolve@^3.4.0:
|
||||
object-assign "^4.0.1"
|
||||
tapable "^0.2.7"
|
||||
|
||||
entities@~1.1.1:
|
||||
entities@^1.1.1, entities@~1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0"
|
||||
|
||||
enzyme-adapter-react-15@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/enzyme-adapter-react-15/-/enzyme-adapter-react-15-1.0.5.tgz#99f9a03ff2c2303e517342935798a6bdfbb75fac"
|
||||
dependencies:
|
||||
enzyme-adapter-utils "^1.1.0"
|
||||
lodash "^4.17.4"
|
||||
object.assign "^4.0.4"
|
||||
object.values "^1.0.4"
|
||||
prop-types "^15.5.10"
|
||||
|
||||
enzyme-adapter-react-16@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.1.1.tgz#a8f4278b47e082fbca14f5bfb1ee50ee650717b4"
|
||||
dependencies:
|
||||
enzyme-adapter-utils "^1.3.0"
|
||||
lodash "^4.17.4"
|
||||
object.assign "^4.0.4"
|
||||
object.values "^1.0.4"
|
||||
prop-types "^15.6.0"
|
||||
react-reconciler "^0.7.0"
|
||||
react-test-renderer "^16.0.0-0"
|
||||
|
||||
enzyme-adapter-utils@^1.1.0, enzyme-adapter-utils@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.3.0.tgz#d6c85756826c257a8544d362cc7a67e97ea698c7"
|
||||
dependencies:
|
||||
lodash "^4.17.4"
|
||||
object.assign "^4.0.4"
|
||||
prop-types "^15.6.0"
|
||||
|
||||
enzyme@^3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.3.0.tgz#0971abd167f2d4bf3f5bd508229e1c4b6dc50479"
|
||||
dependencies:
|
||||
cheerio "^1.0.0-rc.2"
|
||||
function.prototype.name "^1.0.3"
|
||||
has "^1.0.1"
|
||||
is-boolean-object "^1.0.0"
|
||||
is-callable "^1.1.3"
|
||||
is-number-object "^1.0.3"
|
||||
is-string "^1.0.4"
|
||||
is-subset "^0.1.1"
|
||||
lodash "^4.17.4"
|
||||
object-inspect "^1.5.0"
|
||||
object-is "^1.0.1"
|
||||
object.assign "^4.1.0"
|
||||
object.entries "^1.0.4"
|
||||
object.values "^1.0.4"
|
||||
raf "^3.4.0"
|
||||
rst-selector-parser "^2.2.3"
|
||||
|
||||
errno@^0.1.3, errno@~0.1.7:
|
||||
version "0.1.7"
|
||||
resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618"
|
||||
@@ -2149,6 +2232,16 @@ error-ex@^1.2.0:
|
||||
dependencies:
|
||||
is-arrayish "^0.2.1"
|
||||
|
||||
es-abstract@^1.6.1:
|
||||
version "1.12.0"
|
||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165"
|
||||
dependencies:
|
||||
es-to-primitive "^1.1.1"
|
||||
function-bind "^1.1.1"
|
||||
has "^1.0.1"
|
||||
is-callable "^1.1.3"
|
||||
is-regex "^1.0.4"
|
||||
|
||||
es-abstract@^1.7.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864"
|
||||
@@ -2786,10 +2879,18 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2:
|
||||
mkdirp ">=0.5 0"
|
||||
rimraf "2"
|
||||
|
||||
function-bind@^1.0.2, function-bind@^1.1.1:
|
||||
function-bind@^1.0.2, function-bind@^1.1.0, function-bind@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
|
||||
|
||||
function.prototype.name@^1.0.3:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.0.tgz#8bd763cc0af860a859cc5d49384d74b932cd2327"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
function-bind "^1.1.1"
|
||||
is-callable "^1.1.3"
|
||||
|
||||
functional-red-black-tree@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
|
||||
@@ -2982,6 +3083,10 @@ has-flag@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
|
||||
|
||||
has-symbols@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44"
|
||||
|
||||
has-unicode@^2.0.0:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9"
|
||||
@@ -3118,6 +3223,17 @@ html-webpack-plugin@2.29.0:
|
||||
pretty-error "^2.0.2"
|
||||
toposort "^1.0.0"
|
||||
|
||||
htmlparser2@^3.9.1:
|
||||
version "3.9.2"
|
||||
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.9.2.tgz#1bdf87acca0f3f9e53fa4fcceb0f4b4cbb00b338"
|
||||
dependencies:
|
||||
domelementtype "^1.3.0"
|
||||
domhandler "^2.3.0"
|
||||
domutils "^1.5.1"
|
||||
entities "^1.1.1"
|
||||
inherits "^2.0.1"
|
||||
readable-stream "^2.0.2"
|
||||
|
||||
htmlparser2@~3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.3.0.tgz#cc70d05a59f6542e43f0e685c982e14c924a9efe"
|
||||
@@ -3311,6 +3427,10 @@ is-binary-path@^1.0.0:
|
||||
dependencies:
|
||||
binary-extensions "^1.0.0"
|
||||
|
||||
is-boolean-object@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.0.tgz#98f8b28030684219a95f375cfbd88ce3405dff93"
|
||||
|
||||
is-buffer@^1.1.5:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
|
||||
@@ -3400,6 +3520,10 @@ is-npm@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4"
|
||||
|
||||
is-number-object@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.3.tgz#f265ab89a9f445034ef6aff15a8f00b00f551799"
|
||||
|
||||
is-number@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f"
|
||||
@@ -3474,6 +3598,14 @@ is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
||||
|
||||
is-string@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.4.tgz#cc3a9b69857d621e963725a24caeec873b826e64"
|
||||
|
||||
is-subset@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6"
|
||||
|
||||
is-svg@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-svg/-/is-svg-2.1.0.tgz#cf61090da0d9efbcab8722deba6f032208dbb0e9"
|
||||
@@ -4051,6 +4183,10 @@ lodash.defaults@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
|
||||
|
||||
lodash.flattendeep@^4.4.0:
|
||||
version "4.4.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2"
|
||||
|
||||
lodash.memoize@^4.1.2:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
|
||||
@@ -4305,6 +4441,15 @@ ncname@1.0.x:
|
||||
dependencies:
|
||||
xml-char-classes "^1.0.0"
|
||||
|
||||
nearley@^2.7.10:
|
||||
version "2.13.0"
|
||||
resolved "https://registry.yarnpkg.com/nearley/-/nearley-2.13.0.tgz#6e7b0f4e68bfc3e74c99eaef2eda39e513143439"
|
||||
dependencies:
|
||||
nomnom "~1.6.2"
|
||||
railroad-diagrams "^1.0.0"
|
||||
randexp "0.4.6"
|
||||
semver "^5.4.1"
|
||||
|
||||
negotiator@0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
|
||||
@@ -4383,6 +4528,13 @@ node-pre-gyp@^0.6.39:
|
||||
tar "^2.2.1"
|
||||
tar-pack "^3.4.0"
|
||||
|
||||
nomnom@~1.6.2:
|
||||
version "1.6.2"
|
||||
resolved "https://registry.yarnpkg.com/nomnom/-/nomnom-1.6.2.tgz#84a66a260174408fc5b77a18f888eccc44fb6971"
|
||||
dependencies:
|
||||
colors "0.5.x"
|
||||
underscore "~1.4.4"
|
||||
|
||||
nopt@^4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d"
|
||||
@@ -4463,10 +4615,36 @@ object-hash@^1.1.4:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.2.0.tgz#e96af0e96981996a1d47f88ead8f74f1ebc4422b"
|
||||
|
||||
object-keys@^1.0.8:
|
||||
object-inspect@^1.5.0:
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b"
|
||||
|
||||
object-is@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.1.tgz#0aa60ec9989a0b3ed795cf4d06f62cf1ad6539b6"
|
||||
|
||||
object-keys@^1.0.11, object-keys@^1.0.8:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
|
||||
|
||||
object.assign@^4.0.4, object.assign@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
function-bind "^1.1.1"
|
||||
has-symbols "^1.0.0"
|
||||
object-keys "^1.0.11"
|
||||
|
||||
object.entries@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.0.4.tgz#1bf9a4dd2288f5b33f3a993d257661f05d161a5f"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
es-abstract "^1.6.1"
|
||||
function-bind "^1.1.0"
|
||||
has "^1.0.1"
|
||||
|
||||
object.omit@^2.0.0:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa"
|
||||
@@ -4474,6 +4652,15 @@ object.omit@^2.0.0:
|
||||
for-own "^0.1.4"
|
||||
is-extendable "^0.1.1"
|
||||
|
||||
object.values@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.0.4.tgz#e524da09b4f66ff05df457546ec72ac99f13069a"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
es-abstract "^1.6.1"
|
||||
function-bind "^1.1.0"
|
||||
has "^1.0.1"
|
||||
|
||||
obuf@^1.0.0, obuf@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.1.tgz#104124b6c602c6796881a042541d36db43a5264e"
|
||||
@@ -4639,6 +4826,12 @@ parse5@^1.5.1:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94"
|
||||
|
||||
parse5@^3.0.1:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c"
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
parseurl@~1.3.2:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3"
|
||||
@@ -5183,12 +5376,23 @@ querystringify@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-1.0.0.tgz#6286242112c5b712fa654e526652bf6a13ff05cb"
|
||||
|
||||
raf@3.4.0:
|
||||
raf@3.4.0, raf@^3.4.0:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.0.tgz#a28876881b4bc2ca9117d4138163ddb80f781575"
|
||||
dependencies:
|
||||
performance-now "^2.1.0"
|
||||
|
||||
railroad-diagrams@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz#eb7e6267548ddedfb899c1b90e57374559cddb7e"
|
||||
|
||||
randexp@0.4.6:
|
||||
version "0.4.6"
|
||||
resolved "https://registry.yarnpkg.com/randexp/-/randexp-0.4.6.tgz#e986ad5e5e31dae13ddd6f7b3019aa7c87f60ca3"
|
||||
dependencies:
|
||||
discontinuous-range "1.0.0"
|
||||
ret "~0.1.10"
|
||||
|
||||
randomatic@^1.1.3:
|
||||
version "1.1.7"
|
||||
resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c"
|
||||
@@ -5267,6 +5471,19 @@ react-error-overlay@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-4.0.0.tgz#d198408a85b4070937a98667f500c832f86bd5d4"
|
||||
|
||||
react-is@^16.4.1:
|
||||
version "16.4.1"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.4.1.tgz#d624c4650d2c65dbd52c72622bbf389435d9776e"
|
||||
|
||||
react-reconciler@^0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/react-reconciler/-/react-reconciler-0.7.0.tgz#9614894103e5f138deeeb5eabaf3ee80eb1d026d"
|
||||
dependencies:
|
||||
fbjs "^0.8.16"
|
||||
loose-envify "^1.1.0"
|
||||
object-assign "^4.1.1"
|
||||
prop-types "^15.6.0"
|
||||
|
||||
react-scripts@1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-1.1.4.tgz#d5c230e707918d6dd2d06f303b10f5222d017c88"
|
||||
@@ -5312,6 +5529,15 @@ react-scripts@1.1.4:
|
||||
optionalDependencies:
|
||||
fsevents "^1.1.3"
|
||||
|
||||
react-test-renderer@^16.0.0-0:
|
||||
version "16.4.1"
|
||||
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.4.1.tgz#f2fb30c2c7b517db6e5b10ed20bb6b0a7ccd8d70"
|
||||
dependencies:
|
||||
fbjs "^0.8.16"
|
||||
object-assign "^4.1.1"
|
||||
prop-types "^15.6.0"
|
||||
react-is "^16.4.1"
|
||||
|
||||
react-transition-group@^2.3.0:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.3.1.tgz#31d611b33e143a5e0f2d94c348e026a0f3b474b6"
|
||||
@@ -5630,6 +5856,10 @@ restore-cursor@^2.0.0:
|
||||
onetime "^2.0.0"
|
||||
signal-exit "^3.0.2"
|
||||
|
||||
ret@~0.1.10:
|
||||
version "0.1.15"
|
||||
resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc"
|
||||
|
||||
right-align@^0.1.1:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef"
|
||||
@@ -5649,6 +5879,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
|
||||
hash-base "^2.0.0"
|
||||
inherits "^2.0.1"
|
||||
|
||||
rst-selector-parser@^2.2.3:
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz#81b230ea2fcc6066c89e3472de794285d9b03d91"
|
||||
dependencies:
|
||||
lodash.flattendeep "^4.4.0"
|
||||
nearley "^2.7.10"
|
||||
|
||||
run-async@^2.2.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0"
|
||||
@@ -6301,6 +6538,10 @@ uid-number@^0.0.6:
|
||||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81"
|
||||
|
||||
underscore@~1.4.4:
|
||||
version "1.4.4"
|
||||
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.4.4.tgz#61a6a32010622afa07963bf325203cf12239d604"
|
||||
|
||||
uniq@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff"
|
||||
|
||||
@@ -189,6 +189,18 @@ ReactDOM.render(
|
||||
|
||||
---
|
||||
|
||||
## Testing components
|
||||
|
||||
You must include Polaris context in your tests when you use Polaris components.
|
||||
|
||||
To make this easier for you, we've provided:
|
||||
|
||||
- a `createPolarisContext()` function to create the Polaris context for you
|
||||
- a `polarisContextTypes` variable that contains all the necessary context types
|
||||
- a fully-working [example app with Jest and Enzyme](https://github.com/Shopify/polaris/tree/master/examples/create-react-app) you can reference
|
||||
|
||||
---
|
||||
|
||||
## Additional methods
|
||||
|
||||
Some functionality of the underlying EASDK API, like displaying a flash message from within your embedded app, can be accessed through [various methods](https://github.com/Shopify/polaris/blob/master/documentation/Embedded%20apps.md#access-to-further-easdk-apis). Please note, these methods are scheduled to be removed in a future release of updated Polaris components and the current implementation will be deprecated. At that time, new methods will be provided and the old methods will become backwards compatible.
|
||||
|
||||
Reference in New Issue
Block a user