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', () => { ...@@ -208,7 +208,7 @@ describe('GroupListItem', () => {
const onExpand = sinon.stub(); const onExpand = sinon.stub();
const wrapper = createGroupListItem(fakeGroup, { onExpand }); const wrapper = createGroupListItem(fakeGroup, { onExpand });
const toggleSubmenu = () => { const toggleSubmenu = () => {
const dummyEvent = new Event(); const dummyEvent = new Event('dummy');
act(() => { act(() => {
wrapper wrapper
.find('MenuItem') .find('MenuItem')
......
...@@ -57,8 +57,8 @@ describe('Slider', () => { ...@@ -57,8 +57,8 @@ describe('Slider', () => {
wrapper.setProps({ visible: false }); wrapper.setProps({ visible: false });
setTimeout(() => { setTimeout(() => {
const { height } = wrapper.getDOMNode().getBoundingClientRect(); const containerStyle = wrapper.getDOMNode().style;
assert.equal(height, 0); assert.equal(containerStyle.height, '0px');
done(); done();
}, 1); }, 1);
}); });
......
...@@ -31,7 +31,7 @@ describe('Timestamp', () => { ...@@ -31,7 +31,7 @@ describe('Timestamp', () => {
it('displays a link if an "href" is provided', () => { it('displays a link if an "href" is provided', () => {
const wrapper = createTimestamp({ const wrapper = createTimestamp({
timestamp: '', timestamp: '2016-06-10',
href: 'https://example.com', href: 'https://example.com',
}); });
const link = wrapper.find('a'); const link = wrapper.find('a');
...@@ -40,7 +40,7 @@ describe('Timestamp', () => { ...@@ -40,7 +40,7 @@ describe('Timestamp', () => {
}); });
it('displays static text if no "href" is provided', () => { 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('a').length, 0);
assert.equal(wrapper.find('span').length, 1); assert.equal(wrapper.find('span').length, 1);
}); });
......
...@@ -22,7 +22,7 @@ describe('sidebar.services.api', function() { ...@@ -22,7 +22,7 @@ describe('sidebar.services.api', function() {
function defaultBodyForStatus(status) { function defaultBodyForStatus(status) {
if (status === 204) { if (status === 204) {
return ''; return null;
} else if (status >= 500) { } else if (status >= 500) {
return '<html><body>Internal Server Error</body></html>'; return '<html><body>Internal Server Error</body></html>';
} else { } 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