mirror of
https://github.com/tenrok/vue-cron-editor-bootstrap.git
synced 2026-06-23 20:50:33 +03:00
publish test
This commit is contained in:
+8
-4
@@ -1,12 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-cron-editor-bootstrap",
|
"name": "vue-cron-editor-bootstrap",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"private": false,
|
"private": false,
|
||||||
|
"main": "dist/vueCronEditorBootstrap.umd.js",
|
||||||
|
"module": "dist/vueCronEditorBootstrap.esm.js",
|
||||||
|
"unpkg": "dist/vueCronEditorBootstrap.min.js",
|
||||||
|
"browser": {
|
||||||
|
"./sfc": "src/VueCronEditorBootstrap.vue"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"test:unit": "vue-cli-service test:unit",
|
"build:npm": "vue-cli-service build --target lib --name vueCronEditorBootstrap src/VueCronEditorBootstrap.vue"
|
||||||
"lint": "vue-cli-service lint",
|
|
||||||
"release:samples": "vue-cli-service build && gh-pages -d dist"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap-vue": "^2.14.0",
|
"bootstrap-vue": "^2.14.0",
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import VueCronEditorBootstrap from "./components/VueCronEditorBootstrap.vue";
|
import VueCronEditorBootstrap from "./VueCronEditorBootstrap.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ import {
|
|||||||
} from "bootstrap-vue";
|
} from "bootstrap-vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "VueCronEditorBuefy",
|
name: "VueCronEditorBootstrap",
|
||||||
mixins: [vueCronEditorMixin],
|
mixins: [vueCronEditorMixin],
|
||||||
components: {
|
components: {
|
||||||
BFormInput,
|
BFormInput,
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import { shallowMount } from "@vue/test-utils";
|
|
||||||
import VueCronEditorBootstrap from "../../src/components/VueCronEditorBootstrap.vue";
|
|
||||||
import Vue from "vue";
|
|
||||||
|
|
||||||
function getMountedComponent(Component: any, propsData: any) {
|
|
||||||
return shallowMount(Component, {
|
|
||||||
propsData
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("changing expression updates data", () => {
|
|
||||||
it("when changing to expression from different tab, data is updated", async () => {
|
|
||||||
let component = getMountedComponent(VueCronEditorBootstrap, {
|
|
||||||
value: "*/43 * * * *"
|
|
||||||
});
|
|
||||||
component.setProps({ value: "0 0 * * 1,3,4" });
|
|
||||||
|
|
||||||
await Vue.nextTick();
|
|
||||||
|
|
||||||
expect(component.vm.$data.currentTab).toBe("weekly");
|
|
||||||
expect(component.vm.$data.editorData).toStrictEqual({
|
|
||||||
days: ["1", "3", "4"],
|
|
||||||
hours: 0,
|
|
||||||
minutes: 0,
|
|
||||||
type: "weekly"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
import { shallowMount } from "@vue/test-utils";
|
|
||||||
import VueCronEditorBootstrap from "../../src/components/VueCronEditorBootstrap.vue";
|
|
||||||
|
|
||||||
function getMountedComponent(Component: any, propsData: any) {
|
|
||||||
return shallowMount(Component, {
|
|
||||||
propsData
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("isAdvancedVisible prop", () => {
|
|
||||||
it("renders advanced tab when isAdvancedVisible is true", () => {
|
|
||||||
let component = getMountedComponent(VueCronEditorBootstrap, {
|
|
||||||
isAdvancedTabVisible: true
|
|
||||||
});
|
|
||||||
expect(component.find(".advanced-tab").exists()).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("does not render advanced tab when isAdvancedVisible is false", () => {
|
|
||||||
let component = getMountedComponent(VueCronEditorBootstrap, {
|
|
||||||
isAdvancedTabVisible: false
|
|
||||||
});
|
|
||||||
expect(component.find(".advanced-tab").exists()).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import { parseExpression } from "../../src/components/core/cronExpressions";
|
|
||||||
|
|
||||||
test("parse week expression", () => {
|
|
||||||
expect(parseExpression("4 4 * * 0,2,3,5")).toStrictEqual({
|
|
||||||
type: "weekly",
|
|
||||||
hours: 4,
|
|
||||||
minutes: 4,
|
|
||||||
days: ["0", "2", "3", "5"]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("parse all week days expression", () => {
|
|
||||||
expect(parseExpression("4 4 * * 0,1,2,3,4,5,6")).toStrictEqual({
|
|
||||||
type: "weekly",
|
|
||||||
hours: 4,
|
|
||||||
minutes: 4,
|
|
||||||
days: ["0", "1", "2", "3", "4", "5", "6"]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user