samedi 2 juillet 2016

JQuery, Jasmine: How to unit test select, open, render functions of autocomplete

We have a Angular 2 component which consists of JQuery autocomplete. The high level implementation details inside ngOnInit, is as follows -

this.autocomp = $(this.elementRef.nativeElement).children().eq(0).autocomplete({
source:    //implementation details
select:    //implementation details
open:      //implementation details
});
//rendering implementation

I understand we should try and avoid UI details for our unit testing. However, still wanted to understand what I can unit test here? I am interested in a way to unit test/access source, select, open and rendering section.

Our template URL is very basic and consists of an Input and Span.

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire