From 5f06576f51ece88d846d01abd2ddd575827c6127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20P=C3=B6schko?= Date: Thu, 15 Nov 2018 00:34:46 +0100 Subject: [PATCH] Add a checkbox to fixtures UI to choose React production build (#13786) * Add a checkbox to fixtures UI to choose React production build * Assign header__label class name to label directly, instead of using a separate span * center the production checkbox vertically --- fixtures/dom/.gitignore | 3 +++ fixtures/dom/package.json | 2 +- fixtures/dom/src/components/Header.js | 21 +++++++++++++++- fixtures/dom/src/react-loader.js | 36 +++++++++++++++++++-------- fixtures/dom/src/style.css | 9 +++++++ 5 files changed, 59 insertions(+), 12 deletions(-) diff --git a/fixtures/dom/.gitignore b/fixtures/dom/.gitignore index bffad9e24b6d..9f05c1cc2b73 100644 --- a/fixtures/dom/.gitignore +++ b/fixtures/dom/.gitignore @@ -9,8 +9,11 @@ coverage # production build public/react.development.js +public/react.production.min.js public/react-dom.development.js +public/react-dom.production.min.js public/react-dom-server.browser.development.js +public/react-dom-server.browser.production.min.js # misc .DS_Store diff --git a/fixtures/dom/package.json b/fixtures/dom/package.json index 0f2959684a65..90cb22479c12 100644 --- a/fixtures/dom/package.json +++ b/fixtures/dom/package.json @@ -18,7 +18,7 @@ }, "scripts": { "start": "react-scripts start", - "prestart": "cp ../../build/dist/react.development.js ../../build/dist/react-dom.development.js ../../build/dist/react-dom-server.browser.development.js public/", + "prestart": "cp ../../build/dist/react.development.js ../../build/dist/react-dom.development.js ../../build/dist/react.production.min.js ../../build/dist/react-dom.production.min.js ../../build/dist/react-dom-server.browser.development.js ../../build/dist/react-dom-server.browser.production.min.js public/", "build": "react-scripts build && cp build/index.html build/200.html", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" diff --git a/fixtures/dom/src/components/Header.js b/fixtures/dom/src/components/Header.js index e4b743ea92c1..8fc03246e84e 100644 --- a/fixtures/dom/src/components/Header.js +++ b/fixtures/dom/src/components/Header.js @@ -7,8 +7,9 @@ class Header extends React.Component { super(props, context); const query = parse(window.location.search); const version = query.version || 'local'; + const production = query.production || false; const versions = [version]; - this.state = {version, versions}; + this.state = {version, versions, production}; } componentWillMount() { getVersionTags().then(tags => { @@ -25,6 +26,14 @@ class Header extends React.Component { } window.location.search = stringify(query); } + handleProductionChange(event) { + const query = parse(window.location.search); + query.production = event.target.checked; + if (!query.production) { + delete query.production; + } + window.location.search = stringify(query); + } handleFixtureChange(event) { window.location.pathname = event.target.value; } @@ -43,6 +52,16 @@ class Header extends React.Component {
+ +