javascript - Angular unit test to check if CSS class has been added to DOM element -
i have ng-repeat produces number of dom elements:
<div "class_{{$index}}" ng-click="checktype(type, $index);"ng-repeat="item in items">{{item}}</div>
when clicking between first 2 elements want toggle active class between them, i'm doing following, know addclass
, removeclass
not proper angular way of doing things, working ok me @ moment.
$scope.checktype = function(m, n){ if(m == 'type one'){ $('.class_0').addclass('be_active'); $('.class_1').removeclass('be_active'); } if(m == 'type two'){ $('.class_1').addclass('be_active'); $('.class_0').removeclass('be_active'); } }
my question is, can write angular unit test check if classes have been added / removed?
Comments
Post a Comment