jasmine - Unit testing aurelia view -
i'm new aurelia , wondering if there way unit test aurelia views it's custom bindings? tried load aurelia html view file html fixture using jasmine-jquery, reason never of html dom elements using id.
the functionality trying unit test when mouseover icon, should increase size of icon , change it's background color.
view
<template> <div> <span repeat.for="[automobile] of automobilesarray"> <object id.bind="automobile.id" type="image/svg+xml" style='background-color: white;' data.bind="'./images/' + automobile.id +'.svg'" class="auto-icon img-circle" width="50" mouseover.delegate="mover($event)" mouseout.delegate="mout($event)"> </object> </span> </div>
view model
mover(event: event) { document.getelementbyid(event.srcelement.id).style.backgroundcolor = "yellow"; document.getelementbyid(event.srcelement.id).width = "60px"; } mout(event: event) { document.getelementbyid(event.srcelement.id).style.backgroundcolor = "white"; document.getelementbyid(event.srcelement.id).width = "60px"; }
i'd write in test file test this. doing wrong?
test file
it("vehicle icons should grow in size on mouseover", => () { jasmine.getfixtures().fixturespath = 'base/'; loadfixtures('view.html'); expect($('#automobile.id')).tohavecss({ width: "50px" }); $('#automobile.id').mouseover(); expect($('#automobile.id')).tohavecss({ width: "60px" }); });
you can end end test using protractor. jasmine unit tests not meant have app load , prepare full end end test. achieve please take @ end end tests in skeleton-navigation applications.
Comments
Post a Comment