Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Add a supported browsers section #7174

Merged
merged 2 commits into from
Jun 19, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/src/components/AppRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ export default function AppRouter() {
component={MarkdownDocs}
nav
/>
<Route
title="Supported Browsers"
path="/getting-started/supported-browsers"
content={requireMarkdown('./getting-started/supported-browsers.md')}
component={MarkdownDocs}
nav
/>
</Route>
<Route title="Customization" path="/customization" nav component={AppContent}>
<Route
Expand Down
4 changes: 4 additions & 0 deletions docs/src/pages/getting-started/supported-browsers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Supported Browsers

Material-UI supports the latest, stable releases of all major browsers and platforms.
On Windows, we support Internet Explorer 11 & Microsoft Edge.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it sound like those are the only browsers supported on Windows, but I can't think of a better way to phrase it...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove On Windows

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change that with specific versions over "latest" 👍 .

3 changes: 1 addition & 2 deletions src/Snackbar/Snackbar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ describe('<Snackbar />', () => {
const handleRequestClose = spy();
mount(<Snackbar open onRequestClose={handleRequestClose} message="message" />);

const event = document.createEvent('MouseEvents');
event.initEvent('mouseup', true, true);
const event = new window.Event('mouseup', { view: window, bubbles: true, cancelable: true });
if (document.body) {
document.body.dispatchEvent(event);
}
Expand Down
25 changes: 16 additions & 9 deletions src/internal/ClickAwayListener.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('<ClickAwayListener />', () => {
describe('prop: onClickAway', () => {
it('should be call when clicking away', () => {
const handleClickAway = spy();
mount(
const wrapper = mount(
<ClickAwayListener onClickAway={handleClickAway}><span>Hello</span></ClickAwayListener>,
);

Expand All @@ -39,6 +39,7 @@ describe('<ClickAwayListener />', () => {

assert.strictEqual(handleClickAway.callCount, 1);
assert.deepEqual(handleClickAway.args[0], [event]);
wrapper.unmount();
});

it('should not be call when clicking inside', () => {
Expand All @@ -47,30 +48,36 @@ describe('<ClickAwayListener />', () => {
<ClickAwayListener onClickAway={handleClickAway}><span>Hello</span></ClickAwayListener>,
);

const event = document.createEvent('MouseEvents');
// TODO: replace the deprecated initEvent API. But do the work for now.
event.initEvent('mouseup', true, true);
const event = new window.Event('mouseup', { view: window, bubbles: true, cancelable: true });
const el = findDOMNode(wrapper.instance());
if (el) {
el.dispatchEvent(event);
}

assert.strictEqual(handleClickAway.callCount, 0);
wrapper.unmount();
});

it('should not be call when defaultPrevented', () => {
const handleClickAway = spy();
mount(
<ClickAwayListener onClickAway={handleClickAway}><span>Hello</span></ClickAwayListener>,
const wrapper = mount(
<ClickAwayListener onClickAway={handleClickAway}>
<ClickAwayListener onClickAway={event => event.preventDefault()}>
<span>Hello</span>
</ClickAwayListener>
</ClickAwayListener>,
);

const event = document.createEvent('MouseEvents');
event.initEvent('mouseup', true, true);
event.preventDefault();
const event = new window.Event('mouseup', {
view: window,
bubbles: true,
cancelable: true,
});
if (document.body) {
document.body.dispatchEvent(event);
}
assert.strictEqual(handleClickAway.callCount, 0);
wrapper.unmount();
});
});
});
22 changes: 11 additions & 11 deletions src/styles/breakpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ const defaultBreakpoints = {
export default function createBreakpoints(breakpoints = defaultBreakpoints, unit = 'px', step = 1) {
const values = keys.map(key => breakpoints[key]);

function up(name) {
function up(key) {
let value;
// min-width of xs starts at 0
if (name === 'xs') {
if (key === 'xs') {
value = 0;
} else {
value = breakpoints[name] || name;
value = breakpoints[key] || key;
}
return `@media (min-width:${value}${unit})`;
}

function down(name) {
const value = breakpoints[name] || name;
function down(key) {
const value = breakpoints[key] || key;
return `@media (max-width:${value - step / 100}${unit})`;
}

Expand All @@ -42,16 +42,16 @@ export default function createBreakpoints(breakpoints = defaultBreakpoints, unit
);
}

function only(name) {
const keyIndex = keys.indexOf(name);
function only(key) {
const keyIndex = keys.indexOf(key);
if (keyIndex === keys.length - 1) {
return up(name);
return up(key);
}
return between(name, name);
return between(key, key);
}

function getWidth(name) {
return breakpoints[name];
function getWidth(key) {
return breakpoints[key];
}

return {
Expand Down
3 changes: 2 additions & 1 deletion src/utils/withWidth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { assert } from 'chai';
import { useFakeTimers } from 'sinon';
import { createMount, createShallow } from '../test-utils';
import withWidth, { isWidthDown, isWidthUp } from './withWidth';
import createBreakpoints from '../styles/breakpoints';

const Empty = () => <div />;
Empty.propTypes = {}; // Breaks the referencial transparency for testing purposes.
const EmptyWithWidth = withWidth()(Empty);

const TEST_ENV_WIDTH = 'md';
const TEST_ENV_WIDTH = window.innerWidth > createBreakpoints().getWidth('md') ? 'md' : 'sm';

describe('withWidth', () => {
let shallow;
Expand Down
18 changes: 9 additions & 9 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = function setKarmaConfig(config) {
basePath: '../',
browsers: ['PhantomJS_Sized'],
// to avoid DISCONNECTED messages on travis
browserDisconnectTimeout: 60000, // default 2000
browserDisconnectTimeout: 120000, // default 2000
browserDisconnectTolerance: 1, // default 0
browserNoActivityTimeout: 300000, // default 10000
colors: true,
Expand Down Expand Up @@ -112,7 +112,7 @@ module.exports = function setKarmaConfig(config) {
'BrowserStack_Chrome',
'BrowserStack_Firefox',
'BrowserStack_Safari',
// 'BrowserStack_IE',
'BrowserStack_Edge',
]),
plugins: baseConfig.plugins.concat(['karma-browserstack-launcher']),
customLaunchers: Object.assign({}, baseConfig.customLaunchers, {
Expand All @@ -137,13 +137,13 @@ module.exports = function setKarmaConfig(config) {
browser: 'safari',
browser_version: 'latest',
},
// BrowserStack_IE: {
// base: 'BrowserStack',
// os: 'Windows',
// os_version: '10',
// browser: 'edge',
// browser_version: 'latest',
// },
BrowserStack_Edge: {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wasn't a piece of cake to make the tests run!

base: 'BrowserStack',
os: 'Windows',
os_version: '10',
browser: 'edge',
browser_version: 'latest',
},
}),
});
}
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5020,6 +5020,10 @@ react-addons-perf@^15.4.2:
fbjs "^0.8.4"
object-assign "^4.1.0"

react-addons-test-utils@^15.6.0:
version "15.6.0"
resolved "https://registry.yarnpkg.com/react-addons-test-utils/-/react-addons-test-utils-15.6.0.tgz#062d36117fe8d18f3ba5e06eb33383b0b85ea5b9"

react-docgen@^3.0.0-beta4:
version "3.0.0-beta5"
resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-3.0.0-beta5.tgz#1ae8e506f3608ef00ef1521e29ba61298605b4b1"
Expand Down