Skip to content

Commit 1c6fcbc

Browse files
committed
#9 added spec to test slide creation
1 parent 3b2cc3b commit 1c6fcbc

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

test/components/AppTest.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
// expect(MainComponent.props.className).to.equal('sp-main-container')
1919
// })
2020
// })
21-
import {appWrapper} from 'helpers/fullRenderHelper'
22-
describe('App', () => {
21+
import { appWrapper } from 'helpers/fullRenderHelper'
22+
describe('app', () => {
2323
it('should have its component className as sp-main-container', () => {
2424
expect(appWrapper.children().is('.sp-main-container')).to.equal(true)
2525
})

test/components/header/indexTest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { appWrapper } from 'helpers/fullRenderHelper'
22

3-
describe('Header', () => {
3+
describe('header', () => {
44
it('should add a text widget when clicking insert object button', () => {
55
expect(appWrapper.state().deck.getActiveSlide().components.length).to.equal(
66
1
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { appWrapper } from 'helpers/fullRenderHelper'
2+
3+
describe('slides > well', () => {
4+
it('should add a slide when clicking top insert slide button', () => {
5+
expect(appWrapper.state().deck.getActiveSlide().components.length).to.equal(
6+
1
7+
)
8+
expect(appWrapper.state().deck.components.length).to.equal(4)
9+
appWrapper
10+
.find(
11+
'.sp-well-slide-creator > .btn-success'
12+
)
13+
.first().simulate('click')
14+
expect(appWrapper.state().deck.components.length).to.equal(5)
15+
})
16+
})

test/helpers/fullRenderHelper.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { mount } from 'enzyme'
22
import App from 'components/app'
33
import React from 'react'
4-
5-
export const appWrapper = mount(<App />, { attachTo: app })
4+
export let appWrapper
5+
beforeEach(() => {
6+
appWrapper = mount(<App />, { attachTo: app })
7+
})

0 commit comments

Comments
 (0)