Commit 8988a962 authored by Robert Knight's avatar Robert Knight

Fix test failures in Chrome

- Fix failing `services/api.js` test

  Chrome throws an error when trying to construct a fetch `Response` with
  a non-null `body` if the status is 204.

- Fix Timestamp and GroupListItem test failures in Chrome

  - Pass required type argument to `Event` constructor
  - Pass valid `timestamp` argument to `Timestamp`. This value is passed
    on to date functions which require a valid date/time string.

- Fix Slider transition test in Chrome

  Since the transition from open to closed is animated, the actual element
  height doesn't immediately transition to 0px. Instead of checking the
  actual height, check the target height specified by the current style
  properties.

  The previous code happened to work under PhantomJS, but was conceptually incorrect.
parent 63234da5
......@@ -208,7 +208,7 @@ describe('GroupListItem', () => {
const onExpand = sinon.stub();
const wrapper = createGroupListItem(fakeGroup, { onExpand });
const toggleSubmenu = () => {
const dummyEvent = new Event();
const dummyEvent = new Event('dummy');
act(() => {
wrapper
.find('MenuItem')
......
......@@ -57,8 +57,8 @@ describe('Slider', () => {
wrapper.setProps({ visible: false });
setTimeout(() => {
const { height } = wrapper.getDOMNode().getBoundingClientRect();
assert.equal(height, 0);
const containerStyle = wrapper.getDOMNode().style;
assert.equal(containerStyle.height, '0px');
done();
}, 1);
});
......
......@@ -31,7 +31,7 @@ describe('Timestamp', () => {
it('displays a link if an "href" is provided', () => {
const wrapper = createTimestamp({
timestamp: '',
timestamp: '2016-06-10',
href: 'https://example.com',
});
const link = wrapper.find('a');
......@@ -40,7 +40,7 @@ describe('Timestamp', () => {
});
it('displays static text if no "href" is provided', () => {
const wrapper = createTimestamp({ timestamp: '' });
const wrapper = createTimestamp({ timestamp: '2016-06-10' });
assert.equal(wrapper.find('a').length, 0);
assert.equal(wrapper.find('span').length, 1);
});
......
......@@ -22,7 +22,7 @@ describe('sidebar.services.api', function() {
function defaultBodyForStatus(status) {
if (status === 204) {
return '';
return null;
} else if (status >= 500) {
return '<html><body>Internal Server Error</body></html>';
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment