Skip to content

Commit

Permalink
#9 allow test impress rendering page
Browse files Browse the repository at this point in the history
  • Loading branch information
abbr committed Oct 21, 2017
1 parent ee267e7 commit d38755c
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/components/show/impress.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,6 @@ let Presentation = class extends AutoScale.autoScaleMixin(React.Component) {
)
}
}
export default Presentation
// Render the main component into the dom
ReactDOM.render(<Presentation />, document.getElementById('app'))
8 changes: 6 additions & 2 deletions test/components/appTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
// expect(MainComponent.props.className).to.equal('sp-main-container')
// })
// })
import { appWrapper } from 'helpers/fullRenderHelper'
import getAppWrapper from 'helpers/fullRenderHelper'
describe('app', () => {
let appWrapper
beforeEach(()=>{
appWrapper = getAppWrapper('App')
})
it('should have its component className as sp-main-container', () => {
expect(appWrapper.children().is('.sp-main-container')).to.equal(true)
console.log(appWrapper.find('#impress').first())
})
})
7 changes: 6 additions & 1 deletion test/components/header/indexTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { appWrapper } from 'helpers/fullRenderHelper'
import getAppWrapper from 'helpers/fullRenderHelper'

describe('header', () => {
let appWrapper
beforeEach(() => {
appWrapper = getAppWrapper('App')
})

it('should add a text widget when clicking insert object button', () => {
expect(appWrapper.state().deck.getActiveSlide().components.length).to.equal(
1
Expand Down
12 changes: 11 additions & 1 deletion test/components/show/impressTest.js
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
// todo: ensure impress.js displays
import getAppWrapper from 'helpers/fullRenderHelper'
describe('show > impress', () => {
let appWrapper
beforeEach(() => {
appWrapper = getAppWrapper('Impress')
})

it('should have 5 initial views', () => {
expect(appWrapper.find('#impress').props().children.length).to.equal(5)
})
})
7 changes: 6 additions & 1 deletion test/components/slides/well/indexTest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { appWrapper } from 'helpers/fullRenderHelper'
import getAppWrapper from 'helpers/fullRenderHelper'
import 'helpers/jquery.simulate.drag-sortable.js'

describe('slides > well', () => {
let appWrapper
beforeEach(() => {
appWrapper = getAppWrapper('App')
})

it('should add a slide when clicking top insert slide button', () => {
expect(appWrapper.state().deck.components.length).to.equal(4)
appWrapper
Expand Down
7 changes: 6 additions & 1 deletion test/components/styler/quickTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { appWrapper } from 'helpers/fullRenderHelper'
import getAppWrapper from 'helpers/fullRenderHelper'

describe('styler > quick', () => {
let appWrapper
beforeEach(() => {
appWrapper = getAppWrapper('App')
})

it('should change style when hover mouse over palette #1', () => {
let otSlide = $('.sp-operating-table .sp-ot-slide')
const originalStyle = otSlide.css('background').slice(0)
Expand Down
7 changes: 6 additions & 1 deletion test/components/widgets/controls/rotateTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { appWrapper } from 'helpers/fullRenderHelper'
import getAppWrapper from 'helpers/fullRenderHelper'

describe('widgets > controls > rotate', () => {
let appWrapper
beforeEach(() => {
appWrapper = getAppWrapper('App')
})

it('should rotate about 90° cw along z axis', () => {
let domComponent = $('.sp-operating-table .sp-ot-slide .sp-component:first')
expect(
Expand Down
7 changes: 6 additions & 1 deletion test/components/widgets/editableComponentTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { appWrapper } from 'helpers/fullRenderHelper'
import getAppWrapper from 'helpers/fullRenderHelper'

describe('widgets > editableComponent', () => {
let appWrapper
beforeEach(() => {
appWrapper = getAppWrapper('App')
})

it('should display edit controls when clicking a widget in ot', () => {
expect(
$(
Expand Down
13 changes: 9 additions & 4 deletions test/helpers/fullRenderHelper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { mount } from 'enzyme'
import App from 'components/app'
import Impress from 'components/show/impress'
import React from 'react'
export let appWrapper
beforeEach(() => {
appWrapper = mount(<App />, { attachTo: document.getElementById('app') })
})
const AppMap = {
App,
Impress
}
export default function(appNm){
let TheApp = AppMap[appNm]
return mount(<TheApp />, { attachTo: document.getElementById('app') })
}

0 comments on commit d38755c

Please sign in to comment.