Plz see the below slider directive code
appCommon.directive('slider', [function () {
return {
require: 'ngModel',
restrict: "A",
link: function (scope, element, attr, ngModel) {
var mySlider = element.slider({
tooltip: 'hide',
value: 0,
max: 100
});
scope.$watch(function () {
return ngModel.$modelValue;
}, function (newValue, oldValue) {
mySlider.slider('setValue', parseInt(newValue));
});
attr.$observe('isDisabled', function (isDisabled) {
if (isDisabled == 'true') {
mySlider.slider('disable');
}
else {
mySlider.slider('enable');
}
});
}
};
}]);
and want to write unit test case for this ..could you please give me the exact test case for this
Dont unit test your directives. Make a controller to contain the logic, and unit test that.
Add this to your directive, and move the logic you want to test to that controller.