Skip to content

Commit

Permalink
feat(core): Two new directives to one bind
Browse files Browse the repository at this point in the history
 - Adds `ui-grid-one-bind-aria-labelledby` and
`ui-grid-one-bind-aria-labelledby-grid` directives to one bind.
 - Fixes a one bind test not being initialized correctly
  • Loading branch information
JLLeitschuh committed Jul 27, 2015
1 parent 9532de2 commit a9d2f90
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
38 changes: 37 additions & 1 deletion src/js/core/directives/ui-grid-one-bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,43 @@
<div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-labelledby-grid="anId" aria-labelledby-Grid="[grid.id]-gridID32"></div>
</pre>
*/
{tag: 'Labelledby', directiveName:'LabelledbyGrid', appendGridId:true, method: 'attr', aria:true}],
{tag: 'Labelledby', directiveName:'LabelledbyGrid', appendGridId:true, method: 'attr', aria:true},
/**
* @ngdoc directive
* @name ui.grid.directive:uiGridOneBindAriaDescribedby
* @element ANY
* @restrict A
* @param {String} uiGridOneBindAriaDescribedby The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
* @description One time binding for the aria-describedby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
*<br/>
* <pre>
<div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby="anId"></div>
</pre>
* Will become:
* <pre>
<div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby="anId" aria-describedby="gridID32"></div>
</pre>
*/
{tag: 'Describedby', method: 'attr', aria:true},
/**
* @ngdoc directive
* @name ui.grid.directive:uiGridOneBindAriaDescribedbyGrid
* @element ANY
* @restrict A
* @param {String} uiGridOneBindAriaDescribedbyGrid The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
* @description One time binding for the aria-labelledby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
* Works somewhat like {@link ui.grid.directive:uiGridOneBindIdGrid} however this one supports a list of ids (seperated by a space) and will dynamically add the
* grid id to each one.
*<br/>
* <pre>
<div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby-grid="anId"></div>
</pre>
* Will become ([grid.id] will be replaced by the actual grid id):
* <pre>
<div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby-grid="anId" aria-describedby="[grid.id]-gridID32"></div>
</pre>
*/
{tag: 'Describedby', directiveName:'DescribedbyGrid', appendGridId:true, method: 'attr', aria:true}],
function(v){

var baseDirectiveName = 'uiGridOneBind';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/core/directives/ui-grid-one-bind.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('ui-grid-one-bind-class', function() {
$compile = _$compile_;

//Initialize the value
$scope.valNull = startingValue;
$scope.val = startingValue;

recompile = function () {
directiveElt = angular.element("<div ui-grid-one-bind-class='{customClass: val}'></div>");
Expand Down

0 comments on commit a9d2f90

Please sign in to comment.