Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<a name="1.1.6"></a>
## [1.1.6](https://github.com/dreambo8563/vue-lazy-calc/compare/v1.1.5...v1.1.6) (2019-03-21)



<a name="1.1.5"></a>
## [1.1.5](https://github.com/dreambo8563/vue-lazy-calc/compare/v1.1.4...v1.1.5) (2019-03-21)

Expand Down
7 changes: 6 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@ module.exports = {
testMatch: [
"**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"
],
testURL: "http://localhost/"
testURL: "http://localhost/",
globals: {
"ts-jest": {
diagnostics: false
}
}
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-lazy-calc",
"version": "1.1.5",
"version": "1.1.6",
"private": false,
"author": "dreambo8563",
"main": "dist/vue-lazy-calc.umd.min.js",
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface ILazyBase {
stream(s?: LazyCalc): LazyStream;
}
export class LazyBase {
constructor() {}
// constructor() {}
static lazy(init: number | object = 0): LazyCalc {
return new LazyCalc(init);
}
Expand Down
20 changes: 19 additions & 1 deletion tests/unit/main.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { LazyBase } from "../../src/main";
///<reference path="../../types/main.d.ts">
///<reference path="../../types/vue.d.ts">
import LazyPlugin, { LazyBase } from "../../src/main";
import Vue from "vue";

describe("base class", () => {
it("lazy with init value", () => {
Expand All @@ -11,4 +14,19 @@ describe("base class", () => {
const stream1 = LazyBase.stream(base1).add(base2);
expect(stream1.value()).toBe(5);
});
it("stream without init value", () => {
const base1 = LazyBase.lazy(1);
const base2 = LazyBase.lazy(4);
const stream1 = LazyBase.stream()
.subtract(base1)
.add(base2);
expect(stream1.value()).toBe(3);
});
it("Vue instantce", () => {
Vue.use(LazyPlugin);
const base1 = Vue.$lzCalc.lazy(1);
const base2 = Vue.$lzCalc.lazy(4);
const stream1 = Vue.$lzCalc.stream(base1).add(base2);
expect(stream1.value()).toBe(5);
});
});
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"baseUrl": ".",
"types": ["jest", "webpack-env"],
"declaration": true,
// "typeRoots": ["types"],
// "typeRoots": ["types", "node_modules/@types"],
"outDir": "./types",
"paths": {
"@/*": ["src/*"]
Expand All @@ -24,7 +24,7 @@
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue"
// "tests/**/*.ts",
// "tests/**/*.ts"
// "tests/**/*.tsx"
],
"exclude": ["node_modules"]
Expand Down
1 change: 0 additions & 1 deletion types/main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export interface ILazyBase {
stream(s?: LazyCalc): LazyStream;
}
export declare class LazyBase {
constructor();
static lazy(init?: number | object): LazyCalc;
static stream(s?: LazyCalc): LazyStream;
}
Expand Down