-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
188 additions
and
356 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
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,56 @@ | ||
var Montage = require("montage").Montage; | ||
var TestPageLoader = require("montage-testing/testpageloader").TestPageLoader; | ||
|
||
TestPageLoader.queueTest("checkbox-test", function(testPage) { | ||
|
||
describe("test/checkbox/checkbox-spec", function() { | ||
it("should load", function() { | ||
expect(testPage.loaded).toBe(true); | ||
}); | ||
|
||
describe("Checkbox", function() { | ||
describe("default", function () { | ||
it("can be created", function() { | ||
expect(testPage.test.checkbox).toBeDefined(); | ||
}); | ||
var checkbox, defaultChecked, defaultRequired; | ||
beforeEach(function() { | ||
if (!checkbox) { | ||
checkbox = testPage.test.checkbox; | ||
//keep default values | ||
defaultChecked = checkbox.checked; | ||
defaultRequired = checkbox.required; | ||
} | ||
//restore default values | ||
checkbox.checked = defaultChecked; | ||
checkbox.required = defaultRequired; | ||
}); | ||
describe("property", function() { | ||
describe("checked", function() { | ||
it("should have correct default", function() { | ||
expect(defaultChecked).toEqual(false); | ||
}); | ||
it("can be set", function() { | ||
checkbox.checked = true; | ||
expect(checkbox.checked).toEqual(true); | ||
}); | ||
}); | ||
}); | ||
describe("interaction", function () { | ||
describe("press", function () { | ||
it("should check checkbox if not already checked", function () { | ||
checkbox.checked = false; | ||
checkbox.handlePress(); | ||
expect(checkbox.checked).toEqual(true); | ||
}); | ||
it("should uncheck checkbox if already checked", function () { | ||
checkbox.checked = true; | ||
checkbox.handlePress(); | ||
expect(checkbox.checked).toEqual(false); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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,40 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<title>Checkbox</title> | ||
<script type="text/javascript" src="../../node_modules/montage/montage.js" data-package="../../"></script> | ||
<script type="text/montage-serialization"> | ||
{ | ||
"test": { | ||
"prototype": "test/checkbox/checkbox-test[Test]", | ||
"properties": { | ||
"checkbox": {"@": "checkbox"}, | ||
"checkboxAttributeChecked": {"@": "checkboxChecked"} | ||
} | ||
}, | ||
|
||
"checkbox": { | ||
"prototype": "ui/checkbox.reel", | ||
"properties": { | ||
"element": {"#": "checkbox"} | ||
} | ||
}, | ||
|
||
"checkboxChecked": { | ||
"prototype": "ui/checkbox.reel", | ||
"properties": { | ||
"element": {"#": "checkboxChecked"} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
</head> | ||
<body> | ||
<h1>Checkbox</h1> | ||
|
||
<div data-montage-id="checkbox"></div> | ||
<div data-montage-id="checkboxChecked" checked required></div> | ||
</body> | ||
</html> |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
# Checkbox | ||
|
||
![Checkbox](https://raw.github.com/montagejs/montage/edge/checkbox.reel/screenshot.png) | ||
|
||
## How to use | ||
|
||
```html | ||
<span data-montage-id="checkbox"></span> | ||
``` | ||
|
||
```json | ||
"checkbox": { | ||
"prototype": "digit/ui/checkbox.reel", | ||
"properties": { | ||
"element": {"#": "checkbox"} | ||
} | ||
} | ||
``` | ||
|
||
|
||
## Available properties | ||
|
||
* `checked` - The checked state of the checkbox. | ||
* `value` - The value of the checkbox. | ||
* `enabled` - The state of the checkbox. | ||
|
||
|
||
## Customizing with CSS | ||
|
||
* `.digit-Checkbox` - The checkbox element | ||
|
||
```css | ||
.digit-Checkbox { | ||
border-color: blue; | ||
} | ||
``` |
File renamed without changes
File renamed without changes
Oops, something went wrong.