-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(toggle): fix toggle-class attribute
Closes #1851
- Loading branch information
1 parent
93d586d
commit 6fbd1a4
Showing
5 changed files
with
86 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
name: simple | ||
component: ionToggle | ||
--- | ||
|
||
<ion-header-bar class="bar-positive"> | ||
<h1 class="title"> | ||
Toggle: Simple Usage | ||
</h1> | ||
</ion-header-bar> | ||
<ion-content ng-controller="MainCtrl" class="padding"> | ||
<h4>Your pizza has {{toppings()}}!</h4> | ||
<ion-toggle ng-model="pizza.pepperoni"> | ||
Pepperoni? | ||
</ion-toggle> | ||
<ion-toggle ng-model="pizza.sausage" toggle-class="toggle-energized"> | ||
Sausage? | ||
</ion-toggle> | ||
<ion-toggle ng-model="pizza.jalapenos" toggle-class="toggle-calm"> | ||
Jalapeno? | ||
</ion-toggle> | ||
<ion-toggle ng-model="pizza.anchovies" toggle-class="toggle-royal"> | ||
Anchovies? | ||
</ion-toggle> | ||
</ion-content> |
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,30 @@ | ||
--- | ||
name: simple | ||
component: ionToggle | ||
--- | ||
|
||
var app = angular.module('simple', ['ionic']); | ||
app.controller('MainCtrl', function($scope) { | ||
$scope.pizza = { | ||
pepperoni: true, | ||
sausage: false, | ||
anchovies: true, | ||
jalapenos: false | ||
}; | ||
|
||
$scope.toppings = function() { | ||
var toppings = Object.keys($scope.pizza).filter(function(flavor) { | ||
return $scope.pizza[flavor]; | ||
}); | ||
if (toppings.length > 1) { | ||
toppings[toppings.length - 1] = 'and ' + toppings[toppings.length - 1]; | ||
} | ||
if (toppings.length > 2) { | ||
return toppings.join(', '); | ||
} else if (toppings.length) { | ||
return toppings.join(' '); | ||
} else { | ||
return 'nothing'; | ||
} | ||
}; | ||
}); |
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,16 @@ | ||
--- | ||
name: simple | ||
component: ionToggle | ||
--- | ||
|
||
it('should uncheck 1st and check 2nd checkbox by clicking its label', function(){ | ||
var ele = element.all(by.css('label.toggle')); | ||
ele.get(0).click(); | ||
ele.get(1).click(); | ||
}); | ||
|
||
it('should check 1st and uncheck 2nd checkbox by clicking its label', function(){ | ||
var ele = element.all(by.css('label.toggle')); | ||
ele.get(0).click(); | ||
ele.get(1).click(); | ||
}); |
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