Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit 6565d08

Browse files
committed
✅ Brings test coverage back up to 100%
1 parent e0fbe85 commit 6565d08

File tree

13 files changed

+445
-28
lines changed

13 files changed

+445
-28
lines changed

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,13 @@
129129
"json"
130130
],
131131
"coveragePathIgnorePatterns": [
132-
"/node_modules/",
133-
"/out/",
134-
"/build/",
135-
"/dist/",
136-
"/test/",
137-
"/docs/"
132+
"./node_modules",
133+
"./out",
134+
"./build",
135+
"./dist",
136+
"./test",
137+
"./docs",
138+
"\\.story.tsx$"
138139
],
139140
"coverageThreshold": {
140141
"global": {

src/renderer/features/example-using-tabs/welcome-screen/sample-tabs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export interface SampleTabsProps {
1919
onChangeTab: (tab: SampleTabType) => void
2020
}
2121

22-
const KEY_1 = `${commandOrControlKey}+1`
23-
const KEY_2 = `${commandOrControlKey}+2`
24-
const KEY_3 = `${commandOrControlKey}+3`
22+
const KEY_1 = `${commandOrControlKey()}+1`
23+
const KEY_2 = `${commandOrControlKey()}+2`
24+
const KEY_3 = `${commandOrControlKey()}+3`
2525

2626
// an extra layer just for the drag style due to electron bug
2727
const ROOT = css(styles.windowDrag)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import * as React from 'react'
2+
import { StorybookStory as Story, StorybookGroup as Group } from '../storybook'
3+
import { storiesOf } from '@storybook/react'
4+
import { CenteredContent } from './index'
5+
6+
storiesOf('CenteredContent', module).add('default', () => (
7+
<Story>
8+
<Group title='default'>
9+
<CenteredContent>
10+
<p>i am in the middle</p>
11+
<p>i am also a really strange component and shouldn't exist.</p>
12+
</CenteredContent>
13+
</Group>
14+
</Story>
15+
))
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as React from 'react'
2+
import { StorybookStory as Story, StorybookGroup as Group } from '../storybook'
3+
4+
import { storiesOf } from '@storybook/react'
5+
import { EnterAnimation } from './index'
6+
// import { Value } from 'react-powerplug'
7+
8+
storiesOf('EnterAnimation', module).add('default', () => (
9+
<Story>
10+
<Group title='grow'>
11+
<EnterAnimation animation='grow'>
12+
<p>hi</p>
13+
</EnterAnimation>
14+
</Group>
15+
<Group title='slide'>
16+
<EnterAnimation animation='slide'>
17+
<p>hi</p>
18+
</EnterAnimation>
19+
</Group>
20+
</Story>
21+
))

src/renderer/platform/components/enter-animation/enter-animation.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const FINISH = cssProps({ transform: `translate(0, 0) scale(1, 1)` })
2828
export class EnterAnimation extends React.Component<EnterAnimationProps, EnterAnimationState> {
2929
state: EnterAnimationState = {}
3030

31+
// istanbul ignore next
3132
componentDidMount() {
3233
setTimeout(() => this.setState({ mounted: true }), 1)
3334
}
@@ -55,6 +56,7 @@ export class EnterAnimation extends React.Component<EnterAnimationProps, EnterAn
5556

5657
// style props
5758
const starting = css(cssProps({ transform, transition }))
59+
// istanbul ignore next
5860
const finishing = css(mounted && FINISH)
5961

6062
return (
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import * as React from 'react'
2+
import { StorybookStory as Story, StorybookGroup as Group } from '../storybook'
3+
import { storiesOf } from '@storybook/react'
4+
import { ScrollableContent } from './index'
5+
6+
storiesOf('ScrollableContent', module).add('default', () => (
7+
<Story>
8+
<Group title='default'>
9+
<ScrollableContent style={{ height: 100 }}>
10+
<p>hi</p>
11+
<p>hi</p>
12+
<p>hi</p>
13+
<p>hi</p>
14+
<p>hi</p>
15+
<p>hi</p>
16+
<p>hi</p>
17+
<p>hi</p>
18+
<p>hi</p>
19+
<p>hi</p>
20+
<p>hi</p>
21+
<p>hi</p>
22+
</ScrollableContent>
23+
</Group>
24+
</Story>
25+
))

src/renderer/platform/components/spin-animation/spin-animation-state.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ test('next', () => {
1010

1111
test('createSpinStates', () => {
1212
const states = createSpinStates({})
13+
expect(typeof states.forward).toBe('function')
1314
expect(typeof states.back).toBe('function')
1415

16+
const forwardResults = states.forward({ value: { get: () => 1 } })
17+
expect(forwardResults.current).toBe(1)
18+
19+
const backResults = states.back({ value: { get: () => 1 } })
20+
expect(backResults.current).toBe(1)
21+
1522
const value: any = () => {}
1623
value.get = () => 1
1724
value.previousState = 'back'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import * as React from 'react'
2+
import { StorybookStory as Story, StorybookGroup as Group } from '../storybook'
3+
4+
import { storiesOf } from '@storybook/react'
5+
import { Tab } from './index'
6+
import { Value } from 'react-powerplug'
7+
8+
storiesOf('Tab', module).add('Tab', () => (
9+
<Story>
10+
<Group title='inactive'>
11+
<Value initial='three'>
12+
{({ value, setValue }) => (
13+
<div style={{ flexDirection: 'row', display: 'flex' }}>
14+
<Tab text='One' active={value === 'one'} onClick={() => setValue('one')} />
15+
<Tab text='Two' active={value === 'two'} onClick={() => setValue('two')} />
16+
<Tab text='Three' active={value === 'three'} onClick={() => setValue('three')} />
17+
<Tab text='Four' active={value === 'four'} onClick={() => setValue('four')} />
18+
</div>
19+
)}
20+
</Value>
21+
</Group>
22+
</Story>
23+
))

src/renderer/platform/components/text/text.story.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ import { storiesOf } from '@storybook/react'
66
import { Text } from './index'
77

88
storiesOf('Text', module)
9-
.add('text styles', () =>
9+
.add('text styles', () => (
1010
<Story>
1111
<Group title='regular text'>
1212
<Text>Hello World!</Text>
1313
<Text>$123.45</Text>
1414
<Text>The quick brown fox jumped over the slow lazy dog.</Text>
1515
</Group>
16+
<Group title='with text property'>
17+
<Text text='Passed in text property' />
18+
</Group>
19+
1620
<Group title='huge paragraph'>
1721
<Text>
1822
Wayfarers intelligentsia salvia sartorial keffiyeh locavore direct trade flexitarian
@@ -45,9 +49,9 @@ storiesOf('Text', module)
4549
<Group title='style={{ color: &quot;red&quot; }}'>
4650
<Text style={{ color: 'red' }}>Hello World!</Text>
4751
</Group>
48-
</Story>,
49-
)
50-
.add('with nested children', () =>
52+
</Story>
53+
))
54+
.add('with nested children', () => (
5155
<Story>
5256
<Group title='with nested children'>
5357
<Text>
@@ -62,5 +66,5 @@ storiesOf('Text', module)
6266
</p>
6367
</Text>
6468
</Group>
65-
</Story>,
66-
)
69+
</Story>
70+
))

src/renderer/platform/utils/keyboard/keyboard.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jest.mock('../../../../shared', () => {
1111
})
1212

1313
import * as Mousetrap from 'mousetrap'
14-
// import * as platform from '../../../../shared/utils/platform/platform'
1514

1615
test('changes tabs', () => {
1716
const fn = () => true
@@ -25,13 +24,13 @@ test('changes tabs', () => {
2524

2625
test('mac is command key', () => {
2726
const { commandOrControlKey } = require('./keyboard')
28-
expect(commandOrControlKey).toBe('command')
27+
expect(commandOrControlKey()).toBe('command')
2928
})
3029

3130
test('non-mac is control', () => {
32-
jest.resetModules()
31+
// jest.resetModules()
3332
const shared = require('../../../../shared')
3433
shared.isMac = jest.fn().mockReturnValue(false)
3534
const { commandOrControlKey } = require('./keyboard')
36-
expect(commandOrControlKey).toBe('ctrl')
35+
expect(commandOrControlKey()).toBe('ctrl')
3736
})

0 commit comments

Comments
 (0)