aboutsummaryrefslogtreecommitdiffstats
path: root/src/widget
diff options
context:
space:
mode:
authorMisko Hevery2011-10-07 11:27:49 -0700
committerIgor Minar2011-10-11 11:01:46 -0700
commitfd822bdaf9d04e522aaa5400b673f333190abe98 (patch)
tree451cd26d3f7da862692d6c56e6e8f235824c180a /src/widget
parent4f78fd692c0ec51241476e6be9a4df06cd62fdd6 (diff)
downloadangular.js-fd822bdaf9d04e522aaa5400b673f333190abe98.tar.bz2
chore(formating): clean code to be function() {
Diffstat (limited to 'src/widget')
-rw-r--r--src/widget/form.js6
-rw-r--r--src/widget/input.js24
-rw-r--r--src/widget/select.js36
3 files changed, 33 insertions, 33 deletions
diff --git a/src/widget/form.js b/src/widget/form.js
index bc34bf0d..b01a07ef 100644
--- a/src/widget/form.js
+++ b/src/widget/form.js
@@ -24,7 +24,7 @@
<doc:example>
<doc:source>
<script>
- function Ctrl(){
+ function Ctrl() {
this.text = 'guest';
}
</script>
@@ -41,12 +41,12 @@
</div>
</doc:source>
<doc:scenario>
- it('should initialize to model', function(){
+ it('should initialize to model', function() {
expect(binding('text')).toEqual('guest');
expect(binding('myForm.input.$valid')).toEqual('true');
});
- it('should be invalid if empty', function(){
+ it('should be invalid if empty', function() {
input('text').enter('');
expect(binding('text')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
diff --git a/src/widget/input.js b/src/widget/input.js
index f82027f4..18d1ae12 100644
--- a/src/widget/input.js
+++ b/src/widget/input.js
@@ -25,7 +25,7 @@ var INTEGER_REGEXP = /^\s*(\-|\+)?\d+\s*$/;
<doc:example>
<doc:source>
<script>
- function Ctrl(){
+ function Ctrl() {
this.text = 'guest';
this.word = /^\w*$/;
}
@@ -87,7 +87,7 @@ var INTEGER_REGEXP = /^\s*(\-|\+)?\d+\s*$/;
<doc:example>
<doc:source>
<script>
- function Ctrl(){
+ function Ctrl() {
this.text = 'me@example.com';
}
</script>
@@ -155,7 +155,7 @@ angularInputType('email', function() {
<doc:example>
<doc:source>
<script>
- function Ctrl(){
+ function Ctrl() {
this.text = 'http://google.com';
}
</script>
@@ -222,7 +222,7 @@ angularInputType('url', function() {
<doc:example>
<doc:source>
<script>
- function Ctrl(){
+ function Ctrl() {
this.names = ['igor', 'misko', 'vojta'];
}
</script>
@@ -295,7 +295,7 @@ angularInputType('list', function() {
<doc:example>
<doc:source>
<script>
- function Ctrl(){
+ function Ctrl() {
this.value = 12;
}
</script>
@@ -359,7 +359,7 @@ angularInputType('number', numericRegexpInputType(NUMBER_REGEXP, 'NUMBER'));
<doc:example>
<doc:source>
<script>
- function Ctrl(){
+ function Ctrl() {
this.value = 12;
}
</script>
@@ -418,7 +418,7 @@ angularInputType('integer', numericRegexpInputType(INTEGER_REGEXP, 'INTEGER'));
<doc:example>
<doc:source>
<script>
- function Ctrl(){
+ function Ctrl() {
this.value1 = true;
this.value2 = 'YES'
}
@@ -446,7 +446,7 @@ angularInputType('integer', numericRegexpInputType(INTEGER_REGEXP, 'INTEGER'));
</doc:scenario>
</doc:example>
*/
-angularInputType('checkbox', function (inputElement) {
+angularInputType('checkbox', function(inputElement) {
var widget = this,
trueValue = inputElement.attr('true-value'),
falseValue = inputElement.attr('false-value');
@@ -490,7 +490,7 @@ angularInputType('checkbox', function (inputElement) {
<doc:example>
<doc:source>
<script>
- function Ctrl(){
+ function Ctrl() {
this.color = 'blue';
}
</script>
@@ -604,7 +604,7 @@ var HTML5_INPUTS_TYPES = makeMap(
<doc:example>
<doc:source>
<script>
- function Ctrl(){
+ function Ctrl() {
this.text = 'guest';
}
</script>
@@ -635,7 +635,7 @@ var HTML5_INPUTS_TYPES = makeMap(
</doc:scenario>
</doc:example>
*/
-angularWidget('input', function (inputElement){
+angularWidget('input', function(inputElement){
this.directives(true);
this.descend(true);
var modelExp = inputElement.attr('ng:model');
@@ -715,7 +715,7 @@ angularWidget('input', function (inputElement){
}
});
- forEach(['valid', 'invalid', 'pristine', 'dirty'], function (name) {
+ forEach(['valid', 'invalid', 'pristine', 'dirty'], function(name) {
widget.$watch('$' + name, function(scope, value) {
inputElement[value ? 'addClass' : 'removeClass']('ng-' + name);
}
diff --git a/src/widget/select.js b/src/widget/select.js
index f397180e..1687721c 100644
--- a/src/widget/select.js
+++ b/src/widget/select.js
@@ -66,7 +66,7 @@
<doc:example>
<doc:source>
<script>
- function MyCntrl(){
+ function MyCntrl() {
this.colors = [
{name:'black', shade:'dark'},
{name:'white', shade:'light'},
@@ -112,7 +112,7 @@
</div>
</doc:source>
<doc:scenario>
- it('should check ng:options', function(){
+ it('should check ng:options', function() {
expect(binding('color')).toMatch('red');
select('color').option('0');
expect(binding('color')).toMatch('black');
@@ -128,7 +128,7 @@
var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/;
-angularWidget('select', function (element){
+angularWidget('select', function(element){
this.directives(true);
this.descend(true);
return element.attr('ng:model') && annotate('$formFactory', function($formFactory, selectElement){
@@ -145,7 +145,7 @@ angularWidget('select', function (element){
alias: selectElement.attr('name'),
controller: optionsExp ? Options : (multiple ? Multiple : Single)});
- selectElement.bind('$destroy', function(){ widget.$destroy(); });
+ selectElement.bind('$destroy', function() { widget.$destroy(); });
widget.$pristine = !(widget.$dirty = false);
@@ -153,7 +153,7 @@ angularWidget('select', function (element){
watchElementProperty(modelScope, widget, 'readonly', selectElement);
watchElementProperty(modelScope, widget, 'disabled', selectElement);
- widget.$on('$validate', function(){
+ widget.$on('$validate', function() {
var valid = !widget.$required || !!widget.$modelValue;
if (valid && multiple && widget.$required) valid = !!widget.$modelValue.length;
if (valid !== !widget.$error.REQUIRED) {
@@ -161,11 +161,11 @@ angularWidget('select', function (element){
}
});
- widget.$on('$viewChange', function(){
+ widget.$on('$viewChange', function() {
widget.$pristine = !(widget.$dirty = true);
});
- forEach(['valid', 'invalid', 'pristine', 'dirty'], function (name) {
+ forEach(['valid', 'invalid', 'pristine', 'dirty'], function(name) {
widget.$watch('$' + name, function(scope, value) {
selectElement[value ? 'addClass' : 'removeClass']('ng-' + name);
});
@@ -173,18 +173,18 @@ angularWidget('select', function (element){
////////////////////////////
- function Multiple(){
+ function Multiple() {
var widget = this;
- this.$render = function(){
+ this.$render = function() {
var items = new HashMap(this.$viewValue);
forEach(selectElement.children(), function(option){
option.selected = isDefined(items.get(option.value));
});
};
- selectElement.bind('change', function (){
- widget.$apply(function(){
+ selectElement.bind('change', function() {
+ widget.$apply(function() {
var array = [];
forEach(selectElement.children(), function(option){
if (option.selected) {
@@ -197,15 +197,15 @@ angularWidget('select', function (element){
}
- function Single(){
+ function Single() {
var widget = this;
- widget.$render = function(){
+ widget.$render = function() {
selectElement.val(widget.$viewValue);
};
- selectElement.bind('change', function(){
- widget.$apply(function(){
+ selectElement.bind('change', function() {
+ widget.$apply(function() {
widget.$emit('$viewChange', selectElement.val());
});
});
@@ -213,7 +213,7 @@ angularWidget('select', function (element){
widget.$viewValue = selectElement.val();
}
- function Options(){
+ function Options() {
var widget = this,
match;
@@ -249,8 +249,8 @@ angularWidget('select', function (element){
});
selectElement.html(''); // clear contents
- selectElement.bind('change', function(){
- widgetScope.$apply(function(){
+ selectElement.bind('change', function() {
+ widgetScope.$apply(function() {
var optionGroup,
collection = valuesFn(modelScope) || [],
key = selectElement.val(),