This repository has been archived by the owner on Jun 10, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathList.spec.js
76 lines (68 loc) · 2.1 KB
/
List.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import List from 'src/List/List'
import ListItem from 'src/List/ListItem'
import ListDivider from 'src/List/ListDivider'
import ripple from 'src/ripple'
import {
createVM,
dataPropagationTest,
attrTest,
} from '../helpers'
describe('List', function () {
it('renders an upgraded list', function () {
const vm = createVM(this, h => (
<List ref='list'>
<ListItem>Item 1</ListItem>
<ListItem>Item 2</ListItem>
</List>
), {
})
vm.$refs.list.should.have.class('mdc-list')
vm.$refs.list.should.match('ul')
})
it('can render a custom tag', function () {
const vm = createVM(this, h => (
<List ref='list' tag='div'>Hello</List>
))
vm.$refs.list.should.have.class('mdc-list')
vm.$refs.list.should.match('div')
})
it('keeps original tag data', dataPropagationTest(List))
describe('attrs', function () {
attrTest(it, 'mdc-list', List, [
'dense',
'two-lines',
])
})
describe('ListItem', function () {
it('renders an upgraded list item', function () {
const vm = createVM(this, h => (
<div>
<List>
<ListItem ref='item'>Item 1</ListItem>
<ListItem v-ripple>
<i class='mdc-list-item__start-detail material-icons'
aria-hidden='true'>network_wifi</i>
<span class='mdc-list-item__text'>
Two-line item
<span class='mdc-list-item__text__secondary'>Secondary text</span>
</span>
</ListItem>
</List>
</div>
), { directives: { ripple }})
vm.$refs.item.should.have.class('mdc-list-item')
vm.$refs.item.should.match('li')
})
it('can render a custom tag', function () {
const vm = createVM(this, h => (
<ListItem ref='item' tag='a'>Hello</ListItem>
))
vm.$refs.item.should.have.class('mdc-list-item')
vm.$refs.item.should.match('a')
})
it('keeps original tag data', dataPropagationTest(ListItem))
})
describe('ListDivider', function () {
it('keeps original tag data', dataPropagationTest(ListDivider))
})
})