Skip to content

Commit

Permalink
docs(authoring-component): Fixed bugs in example code (#239)
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
yeelan0319 committed Feb 3, 2017
1 parent f0d26e6 commit 0d7f37c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/authoring-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class RedblueTogglePrototype {

toggle(isToggled = undefined) {
const wasToggledExplicitlySet = isToggled === Boolean(isToggled);
const toggled = wasToggledExplicitlySet ? isToggled : !this.toggled_;
const toggled = wasToggledExplicitlySet ? isToggled : !this.toggled;
const toggleColorEl = this.root.querySelector('.redblue-toggle__color');
let toggleColor;

Expand Down Expand Up @@ -182,7 +182,6 @@ class RedblueTogglePrototype {

constructor(root) {
this.root = root;
this.toggled_ = false;
this.clickHandler_ = () => this.toggle();
this.initialize();
}
Expand All @@ -197,12 +196,12 @@ class RedblueTogglePrototype {

toggle(isToggled = undefined) {
const wasToggledExplicitlySet = isToggled === Boolean(isToggled);
this.toggled_ = wasToggledExplicitlySet ? isToggled : !this.toggled_;
const toggled = wasToggledExplicitlySet ? isToggled : !this.toggled;

let toggleColor;

SOMEHOW_SET_ATTRIBUTE('aria-pressed', String(this.toggled_));
if (this.toggled_) {
SOMEHOW_SET_ATTRIBUTE('aria-pressed', String(toggled));
if (toggled) {
toggleColor = 'Red';
SOMEHOW_ADD_CLASS('redblue-toggle--toggled');
} else {
Expand Down

0 comments on commit 0d7f37c

Please sign in to comment.