From e6ee9947645c5cca9cf6efd902cae1a4a31ea13c Mon Sep 17 00:00:00 2001 From: Di Peng Date: Mon, 6 Jun 2011 12:13:07 -0700 Subject: Added ng:disabled, ng:checked, ng:multiple, ng:readonly, ng:selected to markup.js. Also added coresponding descriptions live examples and tests for each directive to be displayed on the website. Closes #351 --- src/markups.js | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) (limited to 'src/markups.js') diff --git a/src/markups.js b/src/markups.js index 7edde728..09481187 100644 --- a/src/markups.js +++ b/src/markups.js @@ -235,8 +235,171 @@ angularTextMarkup('option', function(text, textNode, parentElement){ * @param {template} template any string which can contain `{{}}` markup. */ +/** + * @workInProgress + * @ngdoc directive + * @name angular.directive.ng:disabled + * + * @description + * + * The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs: + *
+ * 
+ * + *
+ *
+ * + * the HTML specs do not require browsers preserve the special attributes such as disabled.(The presense of them means true and absense means false) + * This prevents the angular compiler from correctly retrieving the binding expression. + * To solve this problem, we introduce ng:disabled. + * + * @example + + + Click me to toggle:
+ +
+ + it('should toggle button', function() { + expect(element('.doc-example-live :button').attr('disabled')).toBeFalsy(); + input('checked').check(); + expect(element('.doc-example-live :button').attr('disabled')).toBeTruthy(); + }); + +
+ * + * @element ANY + * @param {template} template any string which can contain '{{}}' markup. + */ + + +/** + * @workInProgress + * @ngdoc directive + * @name angular.directive.ng:checked + * + * @description + * the HTML specs do not require browsers preserve the special attributes such as checked.(The presense of them means true and absense means false) + * This prevents the angular compiler from correctly retrieving the binding expression. + * To solve this problem, we introduce ng:checked. + * @example + + + Check me to check both:
+ +
+ + it('should check both checkBoxes', function() { + expect(element('.doc-example-live #checkSlave').attr('checked')).toBeFalsy(); + input('master').check(); + expect(element('.doc-example-live #checkSlave').attr('checked')).toBeTruthy(); + }); + +
+ * + * @element ANY + * @param {template} template any string which can contain '{{}}' markup. + */ + + +/** + * @workInProgress + * @ngdoc directive + * @name angular.directive.ng:multiple + * + * @description + * the HTML specs do not require browsers preserve the special attributes such as multiple.(The presense of them means true and absense means false) + * This prevents the angular compiler from correctly retrieving the binding expression. + * To solve this problem, we introduce ng:multiple. + * + * @example + + + Check me check multiple:
+ +
+ + it('should toggle multiple', function() { + expect(element('.doc-example-live #select').attr('multiple')).toBeFalsy(); + input('checked').check(); + expect(element('.doc-example-live #select').attr('multiple')).toBeTruthy(); + }); + +
+ * + * @element ANY + * @param {template} template any string which can contain '{{}}' markup. + */ + + +/** + * @workInProgress + * @ngdoc directive + * @name angular.directive.ng:readonly + * + * @description + * the HTML specs do not require browsers preserve the special attributes such as readonly.(The presense of them means true and absense means false) + * This prevents the angular compiler from correctly retrieving the binding expression. + * To solve this problem, we introduce ng:readonly. + * @example + + + Check me to make text readonly:
+ +
+ + it('should toggle readonly attr', function() { + expect(element('.doc-example-live :text').attr('readonly')).toBeFalsy(); + input('checked').check(); + expect(element('.doc-example-live :text').attr('readonly')).toBeTruthy(); + }); + +
+ * + * @element ANY + * @param {template} template any string which can contain '{{}}' markup. + */ + + +/** +* @workInProgress +* @ngdoc directive +* @name angular.directive.ng:selected +* +* @description +* the HTML specs do not require browsers preserve the special attributes such as selected.(The presense of them means true and absense means false) +* This prevents the angular compiler from correctly retrieving the binding expression. +* To solve this problem, we introduce ng:selected. +* @example + + + Check me to select:
+ +
+ + it('should select Greetings!', function() { + expect(element('.doc-example-live #greet').attr('selected')).toBeFalsy(); + input('checked').check(); + expect(element('.doc-example-live #greet').attr('selected')).toBeTruthy(); + }); + +
+* @element ANY +* @param {template} template any string which can contain '{{}}' markup. +*/ + + var NG_BIND_ATTR = 'ng:bind-attr'; var SPECIAL_ATTRS = {}; + forEach('src,href,checked,disabled,multiple,readonly,selected'.split(','), function(name) { SPECIAL_ATTRS['ng:' + name] = name; }); -- cgit v1.2.3