From f7936d5c93773e410d4e4d7159cba2349bf88caa Mon Sep 17 00:00:00 2001 From: Ken Wheeler Date: Thu, 25 May 2017 11:10:03 -0400 Subject: [PATCH] Fragment fixes --- .../__snapshots__/presenter.test.js.snap | 6 ---- src/components/manager.js | 5 ++- src/components/presenter.js | 32 +++++++++---------- src/components/slide-set.test.js | 12 +++---- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/components/__snapshots__/presenter.test.js.snap b/src/components/__snapshots__/presenter.test.js.snap index da8258567..d3d1b0f7d 100644 --- a/src/components/__snapshots__/presenter.test.js.snap +++ b/src/components/__snapshots__/presenter.test.js.snap @@ -94,7 +94,6 @@ exports[` should render correctly 1`] = ` dispatch={[Function]} export={false} hash={1} - lastSlide={0} presenterStyle={ Object { "position": "relative", @@ -120,7 +119,6 @@ exports[` should render correctly 1`] = ` dispatch={[Function]} export={false} hash={2} - lastSlide={0} presenterStyle={ Object { "position": "relative", @@ -270,7 +268,6 @@ exports[` should render timer when set in params. 1`] = ` dispatch={[Function]} export={false} hash={1} - lastSlide={0} notes="These are my slide notes!!" presenterStyle={ Object { @@ -297,7 +294,6 @@ exports[` should render timer when set in params. 1`] = ` dispatch={[Function]} export={false} hash={2} - lastSlide={0} presenterStyle={ Object { "position": "relative", @@ -432,7 +428,6 @@ exports[` 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 { @@ -459,7 +454,6 @@ exports[` should render with notes when slides have them. 1`] = ` dispatch={[Function]} export={false} hash={2} - lastSlide={0} presenterStyle={ Object { "position": "relative", diff --git a/src/components/manager.js b/src/components/manager.js index e667c3141..4fd62816d 100644 --- a/src/components/manager.js +++ b/src/components/manager.js @@ -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, { diff --git a/src/components/presenter.js b/src/components/presenter.js index 433f5317d..d4745a8bf 100644 --- a/src/components/presenter.js +++ b/src/components/presenter.js @@ -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', @@ -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, + }) : END; } _renderNotes() { @@ -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, diff --git a/src/components/slide-set.test.js b/src/components/slide-set.test.js index 79ea367be..4c41ff9e9 100644 --- a/src/components/slide-set.test.js +++ b/src/components/slide-set.test.js @@ -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 {}; }; @@ -15,12 +14,13 @@ class MockSlide extends Component { describe('', () => { test('should render correctly', () => { - const wrapper = mount(( + const wrapper = mount( - - ), { context: _mockContext() }); - expect(mountToJson(wrapper)).toMatchSnapshot(); + , + { context: _mockContext() } + ); + expect(wrapper).toMatchSnapshot(); }); });