-
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.
Merge branch 'feature/auto-refresh-field' into alpha
- Loading branch information
Showing
7 changed files
with
185 additions
and
14 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
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,35 @@ | ||
import { describe, it, expect } from "vitest"; | ||
import Field from "../Field"; | ||
|
||
describe("Field", () => { | ||
describe("with the autoRefresh property", () => { | ||
it("should be false as default", () => { | ||
const props = {}; | ||
const field = new Field(props); | ||
expect(field.autoRefresh).toBe(false); | ||
}); | ||
it("should work with text", () => { | ||
const props = { | ||
autorefresh: "1", | ||
}; | ||
const field = new Field(props); | ||
expect(field.autoRefresh).toBe(true); | ||
}); | ||
describe("if autorefresh is not a valid boold", () => { | ||
it("should return false", () => { | ||
const props = { | ||
autorefresh: "abc", | ||
}; | ||
const field = new Field(props); | ||
expect(field.autoRefresh).toBe(false); | ||
}); | ||
}); | ||
it("should return true for readOnly if autoRefresh is set", () => { | ||
const props = { | ||
autorefresh: true, | ||
}; | ||
const field = new Field(props); | ||
expect(field.readOnly).toBe(true); | ||
}); | ||
}); | ||
}); |
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,53 @@ | ||
import { describe, it, expect } from "vitest"; | ||
import { parseBoolAttribute } from "../helpers/nodeParser"; | ||
|
||
describe("parseBoolAttribute", () => { | ||
it("returns true for numeric 1", () => { | ||
expect(parseBoolAttribute(1)).toBe(true); | ||
}); | ||
|
||
it('returns true for string "1"', () => { | ||
expect(parseBoolAttribute("1")).toBe(true); | ||
}); | ||
|
||
it("returns true for boolean true", () => { | ||
expect(parseBoolAttribute(true)).toBe(true); | ||
}); | ||
|
||
it('returns true for string "True"', () => { | ||
expect(parseBoolAttribute("True")).toBe(true); | ||
}); | ||
|
||
it('returns true for string "true"', () => { | ||
expect(parseBoolAttribute("true")).toBe(true); | ||
}); | ||
|
||
it("returns false for numeric 0", () => { | ||
expect(parseBoolAttribute(0)).toBe(false); | ||
}); | ||
|
||
it('returns false for string "0"', () => { | ||
expect(parseBoolAttribute("0")).toBe(false); | ||
}); | ||
|
||
it("returns false for boolean false", () => { | ||
expect(parseBoolAttribute(false)).toBe(false); | ||
}); | ||
|
||
it('returns false for string "False"', () => { | ||
expect(parseBoolAttribute("False")).toBe(false); | ||
}); | ||
|
||
it("returns false for null", () => { | ||
expect(parseBoolAttribute(null)).toBe(false); | ||
}); | ||
|
||
it("returns false for undefined", () => { | ||
expect(parseBoolAttribute(undefined)).toBe(false); | ||
}); | ||
|
||
it("returns false for non-boolean strings", () => { | ||
expect(parseBoolAttribute("yes")).toBe(false); | ||
expect(parseBoolAttribute("no")).toBe(false); | ||
}); | ||
}); |