Skip to content

Commit

Permalink
Fragment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kenwheeler committed May 25, 2017
1 parent 280394e commit f7936d5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
6 changes: 0 additions & 6 deletions src/components/__snapshots__/presenter.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ exports[`<Presenter /> should render correctly 1`] = `
dispatch={[Function]}
export={false}
hash={1}
lastSlide={0}
presenterStyle={
Object {
"position": "relative",
Expand All @@ -120,7 +119,6 @@ exports[`<Presenter /> should render correctly 1`] = `
dispatch={[Function]}
export={false}
hash={2}
lastSlide={0}
presenterStyle={
Object {
"position": "relative",
Expand Down Expand Up @@ -270,7 +268,6 @@ exports[`<Presenter /> should render timer when set in params. 1`] = `
dispatch={[Function]}
export={false}
hash={1}
lastSlide={0}
notes="These are my slide notes!!"
presenterStyle={
Object {
Expand All @@ -297,7 +294,6 @@ exports[`<Presenter /> should render timer when set in params. 1`] = `
dispatch={[Function]}
export={false}
hash={2}
lastSlide={0}
presenterStyle={
Object {
"position": "relative",
Expand Down Expand Up @@ -432,7 +428,6 @@ exports[`<Presenter /> should render with notes when slides have them. 1`] = `
dispatch={[Function]}
export={false}
hash={1}
lastSlide={0}
notes="These are my slide notes!!"
presenterStyle={
Object {
Expand All @@ -459,7 +454,6 @@ exports[`<Presenter /> should render with notes when slides have them. 1`] = `
dispatch={[Function]}
export={false}
hash={2}
lastSlide={0}
presenterStyle={
Object {
"position": "relative",
Expand Down
5 changes: 4 additions & 1 deletion src/components/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,10 @@ export default class Manager extends Component {
});
}
render() {
if (this.props.route.slide === null) return false;
if (this.props.route.slide === null) {
return false;
}

const globals = this.props.route.params.indexOf('export') !== -1
? {
body: Object.assign(this.context.styles.global.body, {
Expand Down
32 changes: 16 additions & 16 deletions src/components/presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class Presenter extends Component {
);
}
_renderMainSlide() {
const { slideIndex, hash, lastSlide } = this.props;
const { slideIndex, hash, lastSlideIndex } = this.props;
const child = this._getSlideByIndex(slideIndex);
const presenterStyle = {
position: 'relative',
Expand All @@ -61,32 +61,32 @@ export default class Presenter extends Component {
export: this.props.route.params.indexOf('export') !== -1,
print: this.props.route.params.indexOf('print') !== -1,
slideIndex,
lastSlide,
lastSlideIndex,
transition: [],
transitionDuration: 0,
presenterStyle,
});
}
_renderNextSlide() {
const { slideIndex, lastSlide } = this.props;
const { slideIndex, lastSlideIndex } = this.props;
const presenterStyle = {
position: 'relative',
};
const child = this._getSlideByIndex(slideIndex + 1);
return child
? cloneElement(child, {
dispatch: this.props.dispatch,
export: this.props.route.params.indexOf('export') !== -1,
print: this.props.route.params.indexOf('print') !== -1,
key: slideIndex + 1,
hash: child.props.id || slideIndex + 1,
slideIndex: slideIndex + 1,
lastSlide,
transition: [],
transitionDuration: 0,
presenterStyle,
appearOff: true,
})
dispatch: this.props.dispatch,
export: this.props.route.params.indexOf('export') !== -1,
print: this.props.route.params.indexOf('print') !== -1,
key: slideIndex + 1,
hash: child.props.id || slideIndex + 1,
slideIndex: slideIndex + 1,
lastSlideIndex,
transition: [],
transitionDuration: 0,
presenterStyle,
appearOff: true,
})
: <EndHeader>END</EndHeader>;
}
_renderNotes() {
Expand Down Expand Up @@ -145,7 +145,7 @@ export default class Presenter extends Component {
Presenter.propTypes = {
dispatch: PropTypes.func,
hash: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
lastSlide: PropTypes.number,
lastSlideIndex: PropTypes.number,
route: PropTypes.object,
slideIndex: PropTypes.number,
slideReference: PropTypes.array,
Expand Down
12 changes: 6 additions & 6 deletions src/components/slide-set.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { Component } from 'react';
import { mount } from 'enzyme';
import { mountToJson } from 'enzyme-to-json';
import SlideSet from './slide-set';

const _mockContext = function () {
const _mockContext = function() {
return {};
};

Expand All @@ -15,12 +14,13 @@ class MockSlide extends Component {

describe('<SlideSet />', () => {
test('should render correctly', () => {
const wrapper = mount((
const wrapper = mount(
<SlideSet>
<MockSlide />
<MockSlide />
</SlideSet>
), { context: _mockContext() });
expect(mountToJson(wrapper)).toMatchSnapshot();
</SlideSet>,
{ context: _mockContext() }
);
expect(wrapper).toMatchSnapshot();
});
});

0 comments on commit f7936d5

Please sign in to comment.