fix(rating): change to read-only
Closes #5371 Closes #5435 BREAKING CHANGE: Attribute supported has been changed to `read-only` from `readonly`
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<div ng-controller="RatingDemoCtrl">
|
||||
<h4>Default</h4>
|
||||
<uib-rating ng-model="rate" max="max" readonly="isReadonly" on-hover="hoveringOver(value)" on-leave="overStar = null" titles="['one','two','three']" aria-labelledby="default-rating"></uib-rating>
|
||||
<uib-rating ng-model="rate" max="max" read-only="isReadonly" on-hover="hoveringOver(value)" on-leave="overStar = null" titles="['one','two','three']" aria-labelledby="default-rating"></uib-rating>
|
||||
<span class="label" ng-class="{'label-warning': percent<30, 'label-info': percent>=30 && percent<70, 'label-success': percent>=70}" ng-show="overStar && !isReadonly">{{percent}}%</span>
|
||||
|
||||
<pre style="margin:15px 0;">Rate: <b>{{rate}}</b> - Readonly is: <i>{{isReadonly}}</i> - Hovering over: <b>{{overStar || "none"}}</b></pre>
|
||||
|
||||
@@ -26,7 +26,7 @@ Rating directive that will take care of visualising a star rating bar.
|
||||
_(Default: `null`)_ -
|
||||
An array of objects defining properties for all icons. In default template, `stateOn` & `stateOff` property is used to specify the icon's class.
|
||||
|
||||
* `readonly`
|
||||
* `read-only`
|
||||
<small class="badge">$</small>
|
||||
<i class="icon-eye-open"></i>
|
||||
_(Default: `false`)_ -
|
||||
|
||||
@@ -85,7 +85,7 @@ angular.module('ui.bootstrap.rating', [])
|
||||
return {
|
||||
require: ['uibRating', 'ngModel'],
|
||||
scope: {
|
||||
readonly: '=?',
|
||||
readonly: '=?readOnly',
|
||||
onHover: '&',
|
||||
onLeave: '&'
|
||||
},
|
||||
|
||||
@@ -125,9 +125,9 @@ describe('rating directive', function() {
|
||||
expect(element.attr('aria-valuemax')).toBe('15');
|
||||
});
|
||||
|
||||
it('handles readonly attribute', function() {
|
||||
it('handles read-only attribute', function() {
|
||||
$rootScope.isReadonly = true;
|
||||
element = $compile('<uib-rating ng-model="rate" readonly="isReadonly"></uib-rating>')($rootScope);
|
||||
element = $compile('<uib-rating ng-model="rate" read-only="isReadonly"></uib-rating>')($rootScope);
|
||||
$rootScope.$digest();
|
||||
|
||||
expect(getState()).toEqual([true, true, true, false, false]);
|
||||
|
||||
Reference in New Issue
Block a user