Skip to content

Commit a9d2f90

Browse files
committed
feat(core): Two new directives to one bind
- 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
1 parent 9532de2 commit a9d2f90

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/js/core/directives/ui-grid-one-bind.js

+37-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,43 @@
199199
<div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-labelledby-grid="anId" aria-labelledby-Grid="[grid.id]-gridID32"></div>
200200
</pre>
201201
*/
202-
{tag: 'Labelledby', directiveName:'LabelledbyGrid', appendGridId:true, method: 'attr', aria:true}],
202+
{tag: 'Labelledby', directiveName:'LabelledbyGrid', appendGridId:true, method: 'attr', aria:true},
203+
/**
204+
* @ngdoc directive
205+
* @name ui.grid.directive:uiGridOneBindAriaDescribedby
206+
* @element ANY
207+
* @restrict A
208+
* @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>.
209+
* @description One time binding for the aria-describedby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
210+
*<br/>
211+
* <pre>
212+
<div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby="anId"></div>
213+
</pre>
214+
* Will become:
215+
* <pre>
216+
<div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby="anId" aria-describedby="gridID32"></div>
217+
</pre>
218+
*/
219+
{tag: 'Describedby', method: 'attr', aria:true},
220+
/**
221+
* @ngdoc directive
222+
* @name ui.grid.directive:uiGridOneBindAriaDescribedbyGrid
223+
* @element ANY
224+
* @restrict A
225+
* @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>.
226+
* @description One time binding for the aria-labelledby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
227+
* 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
228+
* grid id to each one.
229+
*<br/>
230+
* <pre>
231+
<div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby-grid="anId"></div>
232+
</pre>
233+
* Will become ([grid.id] will be replaced by the actual grid id):
234+
* <pre>
235+
<div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby-grid="anId" aria-describedby="[grid.id]-gridID32"></div>
236+
</pre>
237+
*/
238+
{tag: 'Describedby', directiveName:'DescribedbyGrid', appendGridId:true, method: 'attr', aria:true}],
203239
function(v){
204240

205241
var baseDirectiveName = 'uiGridOneBind';

test/unit/core/directives/ui-grid-one-bind.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('ui-grid-one-bind-class', function() {
148148
$compile = _$compile_;
149149

150150
//Initialize the value
151-
$scope.valNull = startingValue;
151+
$scope.val = startingValue;
152152

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

0 commit comments

Comments
 (0)