Navigation

    Monaca & Onsen UI
    • Login
    • Search
    • Tags
    • Blog
    • Playground
    1. Home
    2. Tags
    3. testing

    • D

      Unit tests and navigator
      Onsen UI • ons-navigator onsen1 testing • • d3orn

      2
      0
      Votes
      2
      Posts
      3788
      Views

      D

      I finally figured it out! To mock a ons-navigator do the following: //your code here (coffeScript) dom = "<ons-navigator var='pageNavigator'></ons-navigator>"; navigatorDOM = @$compile(dom)(@$scope); new @NavigatorView(@$scope, navigatorDOM, @controller) spyOn(pageNavigator, 'pushPage').and.callThrough() @controller.showEvent(event) expect(pageNavigator.pushPage).toHaveBeenCalled() Now I can finally write more unit tests! I hope this helps somebody else, because e2e is nice and fun but unit tests are important as well. Cheers
    • Test your Javascript Code with these Unit Testing Frameworks
      Monaca & Onsen UI Articles • javascript testing unit.js screw.unit qunit test mocha protractor jasmine • • OnsenUI

      2
      0
      Votes
      2
      Posts
      4319
      Views

      M

      Hi I would love to hear your thoughts about petrol https://github.com/MGMonge/petrol
    • Mocha + Chai.js unit testing for ES6 with Istanbul code coverage
      Monaca & Onsen UI Articles • tutorial javascript es6 testing • • OnsenUI

      6
      0
      Votes
      6
      Posts
      11295
      Views

      D

      Just looking for the same thing run in the browser, using ES6 classes, systemJS and Babel-plugin transpiler. Have you by any chance written that promised article?