-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(field): add a new property autorefresh
- Loading branch information
Showing
3 changed files
with
62 additions
and
13 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
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 @@ | ||
import { describe, it, expect } from "vitest"; | ||
import Field from "../Field"; | ||
|
||
describe("Field", () => { | ||
describe("with the autoRefresh property", () => { | ||
it("should work with integer", () => { | ||
const props = { | ||
autorefresh: 10, | ||
}; | ||
const field = new Field(props); | ||
expect(field.autoRefresh).toBe(10); | ||
}); | ||
it("should work with text", () => { | ||
const props = { | ||
autorefresh: "10", | ||
}; | ||
const field = new Field(props); | ||
expect(field.autoRefresh).toBe(10); | ||
}); | ||
describe("if autorefresh is not a valid number", () => { | ||
it("should return undefined", () => { | ||
const props = { | ||
autorefresh: "abc", | ||
}; | ||
const field = new Field(props); | ||
expect(field.autoRefresh).toBe(undefined); | ||
}); | ||
}); | ||
it("should return true for readOnly if autoRefresh is set", () => { | ||
const props = { | ||
autorefresh: 10, | ||
}; | ||
const field = new Field(props); | ||
expect(field.readOnly).toBe(true); | ||
}); | ||
}); | ||
}); |