-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(switch): Adds switch element and documentation, closes #16
- Loading branch information
Alec Sibilia
committed
May 2, 2016
1 parent
cc66da3
commit c7d811b
Showing
4 changed files
with
28 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
# Switches & Toggles | ||
|
||
# Button | ||
A button clearly indicates a point of action for the user. Bullhorn buttons come in a variety of themes, custom tailored to fit your use-case. | ||
|
||
## Usage | ||
|
||
```javascript | ||
import { NOVO_BUTTON_ELEMENTS } from 'novo-elements'; | ||
``` | ||
|
||
##### Properties | ||
- `'theme' : String` | ||
* Defines the theme of the button | ||
* Available Values: `['primary', 'secondary', 'neutral', 'dialogue', 'negative', 'icon', 'header']` | ||
- `'icon' : String` | ||
* Icon to be placed in the button | ||
* Available Values: `['check', 'send', 'collapse']` | ||
- `'side' : String` | ||
* Defines what side to place the icon on a **dialogue** theme button. | ||
* Available Values: `['left', 'right']` | ||
- `'inverse' : Bool` | ||
* Can be added to 'dialogue' theme buttons for buttons on a dark background | ||
- `'checked' : Bool` | ||
* Sets the initial state to checked | ||
- `'disabled' : Bool` | ||
* Defines whether the switch is disabled | ||
|
||
#### Outputs | ||
- `'checkedChange': Function` | ||
* An event function that is fired when a switch is switched |
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 |
---|---|---|
@@ -1,11 +1,22 @@ | ||
describe('Component: Button', () => { | ||
describe('Component: Switch', () => { | ||
beforeEach(() => { | ||
browser.get('/#/button'); | ||
browser.get('/#/switch'); | ||
}); | ||
|
||
it('should have <button>', () => { | ||
let subject = element(by.css('demo-app button')).isPresent(); | ||
let result = true; | ||
expect(subject).toEqual(result); | ||
it('should have <novo-switch>', () => { | ||
let subject = element(by.css('demo-app novo-switch')).isPresent(); | ||
expect(subject).toBeTruthy(); | ||
}); | ||
|
||
it('should fire switch event', () => { | ||
let subject = element(by.css('novo-switch[data-automation-id="switchTest"]')); | ||
// test switch | ||
subject.click(); | ||
browser.sleep(300); | ||
expect(subject.getAttribute('aria-checked')).toMatch('false'); | ||
// test switch back | ||
subject.click(); | ||
browser.sleep(300); | ||
expect(subject.getAttribute('aria-checked')).toMatch('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