This repository has been archived by the owner on Apr 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from LavrovArtem/i21
Support components loaded via vue-loader (close #21)
- Loading branch information
Showing
12 changed files
with
196 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<template lang="pug"> | ||
#app | ||
h1 Header | ||
list#list1 | ||
list#list2 | ||
</template> | ||
<script> | ||
import List from './list.vue'; | ||
export default { | ||
components: { List }, | ||
name: 'app' | ||
}; | ||
</script> | ||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template lang="pug"> | ||
li(:id='id') | ||
p {{ id }} | ||
</template> | ||
<script> | ||
export default { | ||
name: 'list-item', | ||
props: ['id'] | ||
}; | ||
</script> | ||
<style> | ||
li { | ||
margin: 0 20px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template lang="pug"> | ||
.list-wrapper | ||
h4 {{ id }} | ||
ul(:id='id') | ||
each index in [1, 2, 3] | ||
list-item(:id=`getId(${index})`) | ||
</template> | ||
<script> | ||
import ListItem from './list-item.vue'; | ||
export default { | ||
components: { ListItem }, | ||
name: 'list', | ||
props: ['id'], | ||
computed: { | ||
reversedId: function () { | ||
return this.id.split('').reverse().join(''); | ||
} | ||
}, | ||
methods: { | ||
getId: function (postfix) { | ||
return this.id + '-item' + postfix; | ||
} | ||
} | ||
}; | ||
</script> | ||
<style> | ||
.list-wrapper { | ||
border-left: dashed 4px #8BC34A; | ||
width: 400px; | ||
} | ||
h4 { | ||
border-bottom: solid 3px beige; | ||
margin: 0 20px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>vue-loader</title> | ||
</head> | ||
<body> | ||
<div id="app"> | ||
<list id="list1"></list> | ||
<list id="list2"></list> | ||
</div> | ||
<script src="/build.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Vue from 'vue'; | ||
import App from './components/app.vue'; | ||
|
||
new Vue({ | ||
el: '#app', | ||
render: h => h(App), | ||
data () { | ||
return { | ||
rootProp1: 1 | ||
}; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import VueSelector from '../lib'; | ||
|
||
fixture `vue-loader` | ||
.page `http://localhost:8080/test/data/vue-loader/`; | ||
|
||
test('composite selector', async t => { | ||
const listItem = VueSelector('list list-item'); | ||
const listItemVue6 = await listItem.nth(5).getVue(); | ||
const listItemVue5Id = listItem.nth(4).getVue(({ props }) => props.id); | ||
|
||
await t | ||
.expect(listItem.count).eql(6) | ||
.expect(listItemVue6.props.id).eql('list2-item3') | ||
.expect(listItemVue5Id).eql('list2-item2'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import VueSelector from '../lib'; | ||
|
||
fixture `page without vue`; | ||
|
||
test('there is no Vue on the tested page', async t => { | ||
const listVueSelector = VueSelector('list'); | ||
|
||
await t.expect(listVueSelector.count).eql(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var path = require('path'); | ||
|
||
module.exports = { | ||
entry: path.resolve(__dirname, './test/data/vue-loader/main.js'), | ||
|
||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'build.js' | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.vue$/, | ||
loader: 'vue-loader' | ||
}, | ||
{ | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
exclude: /node_modules/ | ||
} | ||
] | ||
}, | ||
|
||
devServer: { | ||
noInfo: true, | ||
port: 8080 | ||
} | ||
}; |