Skip to content

Commit 52dd355

Browse files
committed
chore: more tests and configuration
1 parent 321d185 commit 52dd355

File tree

9 files changed

+128
-15
lines changed

9 files changed

+128
-15
lines changed

.github/workflows/build-next.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: build-next
2+
on:
3+
push:
4+
branches: [ develop ]
5+
pull_request:
6+
branches: [ develop ]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
max-parallel: 24
12+
matrix:
13+
node-version: [14.x, 16.x]
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Use Node.js ${{ matrix.node-version }} 🪢
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- name: Install dependencies 📦
21+
run: npm install && npm run bootstrap
22+
- name: Run lint and component tests 🧪
23+
uses: cypress-io/github-action@v2
24+
with:
25+
command: npm run test:oruga-next
26+
- name: Upload coverage 📈
27+
uses: codecov/codecov-action@v2
28+
flags: oruga-next
29+
env:
30+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"scripts": {
55
"bootstrap": "lerna bootstrap",
66
"test:oruga": "lerna run test --scope @oruga-ui/oruga",
7+
"test:oruga-next": "lerna run test --scope @oruga-ui/oruga-next",
8+
"test:watch:oruga-next": "lerna run test --scope @oruga-ui/oruga-next",
79
"ci:oruga": "lerna run ci --scope @oruga-ui/oruga",
810
"lint:oruga": "lerna run lint --scope @oruga-ui/oruga",
911
"lint:fix:oruga": "lerna run lint:fix --scope @oruga-ui/oruga",

packages/oruga-next/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ yarn-error.log*
2121
*.njsproj
2222
*.sln
2323
*.sw?
24+
25+
# Cypress
26+
cypress/videos

packages/oruga-next/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
"build:style:watch": "concurrently \"sass ../oruga/src/scss/oruga-full-vars.scss dist/oruga-full-vars.css --watch\" \"sass ../oruga/src/scss/oruga.scss dist/oruga.css --watch\"",
3737
"build:lib": "rimraf dist && npm run build:vue && npm run build:style",
3838
"build:lib:watch": "npm link && concurrently \"npm run build:vue:watch\" \"npm run build:style:watch\"",
39-
"publish:lib": "cp -R ../oruga/src/scss ./src && cp ../../README.md . && npm run build:lib && npm publish"
39+
"publish:lib": "cp -R ../oruga/src/scss ./src && cp ../../README.md . && npm run build:lib && npm publish",
40+
"test": "rm -rf .nyc_output coverage && NODE_ENV=test cypress run-ct",
41+
"test:watch": "rm -rf .nyc_output coverage && NODE_ENV=test cypress open-ct"
4042
},
4143
"keywords": [
4244
"oruga",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { mount } from '@cypress/vue'
2+
import SimpleAutocomplete from './SimpleAutocomplete.vue'
3+
4+
5+
it('Autocomplete', () => {
6+
mount(SimpleAutocomplete)
7+
cy.get('input').click().type('j')
8+
cy.get('input').type('{downarrow}{downarrow}{enter}')
9+
cy.get('input').should('have.value', 'Node.js')
10+
})
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<template>
2+
<p class="content"><b>Selected:</b> {{ selected }}</p>
3+
<o-field label="Find a JS framework">
4+
<o-autocomplete
5+
rounded
6+
v-model="name"
7+
:data="filteredDataArray"
8+
placeholder="e.g. jQuery"
9+
icon="search"
10+
clearable
11+
@select="select"
12+
>
13+
<template #empty>No results found</template>
14+
</o-autocomplete>
15+
</o-field>
16+
</template>
17+
18+
<script lang="ts">
19+
import { defineComponent } from "vue";
20+
import OAutocomplete from "../Autocomplete.vue";
21+
import OField from "../../field/Field.vue";
22+
export default defineComponent({
23+
data() {
24+
return {
25+
data: [
26+
"Angular",
27+
"Angular 2",
28+
"Aurelia",
29+
"Backbone",
30+
"Ember",
31+
"jQuery",
32+
"Meteor",
33+
"Node.js",
34+
"Polymer",
35+
"React",
36+
"RxJS",
37+
"Vue.js",
38+
],
39+
name: "",
40+
selected: null,
41+
};
42+
},
43+
components: {
44+
[OAutocomplete.name]: OAutocomplete,
45+
[OField.name]: OField,
46+
},
47+
computed: {
48+
filteredDataArray(): string[] {
49+
return this.data.filter((option: any) => {
50+
return (
51+
option.toString().toLowerCase().indexOf(this.name.toLowerCase()) >= 0
52+
);
53+
});
54+
},
55+
},
56+
methods: {
57+
select(option: any) {
58+
this.selected = option;
59+
},
60+
},
61+
});
62+
</script>
63+
64+
<style>
65+
</style>

packages/oruga-next/src/components/button/Button.spec.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { mount } from '@cypress/vue'
2+
import OButton from '../Button.vue'
3+
4+
it('Button', () => {
5+
mount(OButton, {
6+
slots: {
7+
default: {
8+
render: () => 'Hello Cypress!'
9+
}
10+
}
11+
})
12+
13+
cy.get('button').contains('Hello Cypress!').click()
14+
})

packages/oruga-next/vite.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default defineConfig({
1010
include: 'src/*',
1111
exclude: ["node_modules", "cypress/"],
1212
extension: [".ts", ".vue"],
13+
cypress: true
1314
})
1415
]
1516
})

0 commit comments

Comments
 (0)