Skip to content

Commit

Permalink
fix some issues with moment-timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
billyvg committed Aug 22, 2019
1 parent 88efa26 commit f190892
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Flex} from 'grid-emotion';
import PropTypes from 'prop-types';
import React from 'react';
import moment from 'moment';
import moment from 'moment-timezone';
import styled from 'react-emotion';

import {DEFAULT_STATS_PERIOD} from 'app/constants';
Expand Down Expand Up @@ -413,7 +412,8 @@ const Menu = styled('div')`
overflow: hidden;
`;

const SelectorList = styled(({isAbsoluteSelected, ...props}) => <Flex {...props} />)`
const SelectorList = styled('div')`
display: flex;
flex: 1;
flex-direction: column;
flex-shrink: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ exports[`CreateProject should deal with incorrect platform name if its provided
onTouchMove={[Function]}
onTouchStart={[Function]}
>
<span
<div
className="Select-multi-value-wrapper"
id="react-select-5--value"
>
Expand Down Expand Up @@ -1461,7 +1461,7 @@ exports[`CreateProject should deal with incorrect platform name if its provided
/>
</div>
</AutosizeInput>
</span>
</div>
<span
className="Select-arrow-zone"
onMouseDown={[Function]}
Expand Down Expand Up @@ -2372,7 +2372,7 @@ exports[`CreateProject should fill in platform name if its provided by url 1`] =
onTouchMove={[Function]}
onTouchStart={[Function]}
>
<span
<div
className="Select-multi-value-wrapper"
id="react-select-4--value"
>
Expand Down Expand Up @@ -2437,7 +2437,7 @@ exports[`CreateProject should fill in platform name if its provided by url 1`] =
/>
</div>
</AutosizeInput>
</span>
</div>
<span
className="Select-arrow-zone"
onMouseDown={[Function]}
Expand Down Expand Up @@ -4048,7 +4048,7 @@ exports[`CreateProject should fill in project name if its empty when platform is
onTouchMove={[Function]}
onTouchStart={[Function]}
>
<span
<div
className="Select-multi-value-wrapper"
id="react-select-3--value"
>
Expand Down Expand Up @@ -4113,7 +4113,7 @@ exports[`CreateProject should fill in project name if its empty when platform is
/>
</div>
</AutosizeInput>
</span>
</div>
<span
className="Select-arrow-zone"
onMouseDown={[Function]}
Expand Down
13 changes: 7 additions & 6 deletions tests/js/spec/components/charts/chartZoom.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import React from 'react';

import {mount} from 'enzyme';
import ChartZoom from 'app/components/charts/chartZoom';
import ConfigStore from 'app/stores/configStore';

jest.mock('moment', () => {
const moment = require.requireActual('moment-timezone');
moment.tz.setDefault('America/Los_Angeles'); // Whatever timezone you want
return moment;
});

describe('ChartZoom', function() {
const renderFunc = jest.fn(() => null);
Expand All @@ -11,11 +16,7 @@ describe('ChartZoom', function() {
let tooltipFormatter;
const timestamp = 1531094400000;

beforeAll(function() {
ConfigStore.loadInitialData({
user: {options: {timezone: 'America/Los_Angeles'}},
});
});
beforeAll(function() {});

beforeEach(function() {
renderFunc.mockClear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ exports[`SelectField renders without form context 1`] = `
onTouchMove={[Function]}
onTouchStart={[Function]}
>
<span
<div
className="Select-multi-value-wrapper"
id="react-select-2--value"
>
Expand Down Expand Up @@ -394,7 +394,7 @@ exports[`SelectField renders without form context 1`] = `
/>
</div>
</AutosizeInput>
</span>
</div>
<span
aria-label="Clear value"
className="Select-clear-zone"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ exports[`Project Ownership Input renders 1`] = `
onTouchMove={[Function]}
onTouchStart={[Function]}
>
<span
<div
className="Select-multi-value-wrapper"
id="react-select-2--value"
>
Expand Down Expand Up @@ -464,7 +464,7 @@ exports[`Project Ownership Input renders 1`] = `
/>
</div>
</AutosizeInput>
</span>
</div>
<span
className="Select-arrow-zone"
onMouseDown={[Function]}
Expand Down Expand Up @@ -762,7 +762,7 @@ exports[`Project Ownership Input renders 1`] = `
onTouchMove={[Function]}
onTouchStart={[Function]}
>
<span
<div
className="Select-multi-value-wrapper"
id="react-select-3--value"
>
Expand Down Expand Up @@ -827,7 +827,7 @@ exports[`Project Ownership Input renders 1`] = `
/>
</div>
</AutosizeInput>
</span>
</div>
<span
aria-hidden="true"
className="Select-loading-zone"
Expand Down
55 changes: 47 additions & 8 deletions tests/js/spec/views/__snapshots__/ruleBuilder.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ exports[`RuleBuilder renders 1`] = `
onTouchMove={[Function]}
onTouchStart={[Function]}
>
<span
<div
className="Select-multi-value-wrapper"
id="react-select-2--value"
>
Expand Down Expand Up @@ -437,7 +437,7 @@ exports[`RuleBuilder renders 1`] = `
/>
</div>
</AutosizeInput>
</span>
</div>
<span
className="Select-arrow-zone"
onMouseDown={[Function]}
Expand Down Expand Up @@ -881,7 +881,7 @@ exports[`RuleBuilder renders 1`] = `
onTouchMove={[Function]}
onTouchStart={[Function]}
>
<span
<div
className="Select-multi-value-wrapper"
id="react-select-3--value"
>
Expand Down Expand Up @@ -946,7 +946,7 @@ exports[`RuleBuilder renders 1`] = `
/>
</div>
</AutosizeInput>
</span>
</div>
<span
className="Select-arrow-zone"
onMouseDown={[Function]}
Expand Down Expand Up @@ -1604,7 +1604,7 @@ exports[`RuleBuilder renders with suggestions 1`] = `
onTouchMove={[Function]}
onTouchStart={[Function]}
>
<span
<div
className="Select-multi-value-wrapper"
id="react-select-4--value"
>
Expand Down Expand Up @@ -1692,7 +1692,7 @@ exports[`RuleBuilder renders with suggestions 1`] = `
/>
</div>
</AutosizeInput>
</span>
</div>
<span
className="Select-arrow-zone"
onMouseDown={[Function]}
Expand Down Expand Up @@ -2440,7 +2440,7 @@ exports[`RuleBuilder renders with suggestions 1`] = `
onTouchMove={[Function]}
onTouchStart={[Function]}
>
<span
<div
className="Select-multi-value-wrapper"
id="react-select-5--value"
>
Expand Down Expand Up @@ -2489,6 +2489,45 @@ exports[`RuleBuilder renders with suggestions 1`] = `
"value": "user:1",
}
}
values={
Array [
Object {
"actor": Object {
"id": "1",
"name": "Jane Doe",
"type": "user",
},
"label": <IdBadge
avatarSize={24}
hideEmail={true}
useLink={false}
user={
Object {
"email": "janedoe@example.com",
"flags": Object {
"newsletter_consent_prompt": false,
},
"hasPasswordAuth": true,
"id": "1",
"isAuthenticated": true,
"name": "Jane Doe",
"options": Object {
"timezone": "UTC",
},
"user": Object {
"email": "janedoe@example.com",
"id": "1",
"name": "Jane Doe",
},
"username": "foo@example.com",
}
}
/>,
"searchKey": "janedoe@example.com jane doe",
"value": "user:1",
},
]
}
>
<a
onClick={[Function]}
Expand Down Expand Up @@ -2723,7 +2762,7 @@ exports[`RuleBuilder renders with suggestions 1`] = `
/>
</div>
</AutosizeInput>
</span>
</div>
<span
aria-live="assertive"
className="Select-aria-only"
Expand Down

0 comments on commit f190892

Please sign in to comment.