Skip to main content

All Questions

0 votes
1 answer
858 views

Angular Unit Testing Directive for Input Restriction

I have a directive with restricts user from Inputting special characters. Trying to write a unit test that validates to make sure user is not able to input special characters. Below I am trying to ...
Code-Strings's user avatar
0 votes
1 answer
134 views

testing key directive in Angular (9)

I have a directive that I am trying to test. But the length of the value in the directive is always undefined. What am I doing wrong? @Directive({ selector: '[evAutoTab]' }) export class ...
ed4becky's user avatar
  • 1,630
1 vote
2 answers
900 views

Jasmine spyOn not working properly on AngularJS directive

I'm working on an AngularJS app and I'm facing some problems with Jasmine's SpyOn in a concrete directive. The directive is quite simple, just call a service's method and when it resolves/rejects the ...
marc's user avatar
  • 537
0 votes
0 answers
109 views

Unit Testing Keyup AngularJS

I am having the hardest time trying to figure out how to write unit tests for this simple directive. Any help would be greatly appreciated. Quick description: left and right arrow keys will change ...
user avatar
1 vote
1 answer
316 views

Angular Directive function not being called in Unit Testing

I built a new directive in Angular (1.2.29) and I am trying to test it using karma, however I am having some problems when checking if the field is invalid, it seems it's always valid. Here is my ...
TiagoM's user avatar
  • 3,536
1 vote
0 answers
39 views

Unit testing angular directive with link function

My link function of a directive shows some dummy mock ask for external data (promise). Whenever the promise resolves or rejectes dummy data is hidden Is there a way to unit test directive, checking ...
roter's user avatar
  • 11
0 votes
1 answer
172 views

Can't get a directive using a controller test to pass Jasmine : Error: [$injector:unpr] Unknown provider: utilsProvider <- utils

I've been searching a long time for an answer to the question I'm about to ask without success. Let's say I have the following directive : (function () { 'use strict'; angular .module('com.acme....
Laurent Morissette's user avatar
1 vote
1 answer
2k views

Unit Testing Angular Attribute Directive

I am having some problems testing an AngularJS (1.5) Attribute restricted Directive. See the below example directive and following unit test, of which produces a broken unit test. Directive (...
Aaron Brewer's user avatar
  • 3,677
2 votes
1 answer
586 views

Unit tests for Angular js directive for ui-mask

I have a directive called maskUI .directive('uiMask', function () { return { template: '<input ui-mask="{{maskPattern}}"/>', replace: true, scope: true, ...
Nakul's user avatar
  • 35
4 votes
1 answer
3k views

Testing attribute directive

Does anyone know how I can test this attribute directive in Angular 2? I'm looking for some examples, but I have not found it. If someone has an example to show me or show me a way to do it, it would ...
Marcio M.'s user avatar
  • 371
0 votes
1 answer
65 views

Testing angularjs directive for attribute

I have the following directive which works fine and now I need to unit test it, (() => { angular .module('app.utilities') .directive('allowPattern', allowPatternDirective); function ...
digitalis's user avatar
  • 125
0 votes
0 answers
86 views

Testing directive in Angular 2 + Jasmine I am getting an error

I am getting the error below when I run the test using Angular 2 + Jasmine. Does anyone know how can I solve this problem? I already have imported the directive in app.module.ts. Can't bind to '...
Marcio M.'s user avatar
  • 371
0 votes
0 answers
438 views

Angular Directive Karma Jasmine Testing with dependency injection

How can i test a directive that has a constant injected into them? Here is my Below Code. Im also Getting scope.element.node().getBoundingClientRect() to be 0 0 0 0. Please help. Directive (function ...
Keshore Durairaj's user avatar
0 votes
1 answer
23 views

When unit testing a directive how to pass its controller

I am new to AngularJS and its unit test. Currently I am trying to test a directive with its controller in the template file: It's template: <div ng-controller = "SomeController" > <select ...
Lily's user avatar
  • 99
0 votes
0 answers
426 views

Angularjs - Test unit directive only numbers

I have a directives.js file with two directives and I would like apply unit testing necesary, to improve coverage, but I do not know how to do it This the directive.js file: (function () { 'use ...
Eladerezador's user avatar
  • 1,321

15 30 50 per page
1
2 3 4 5
13