Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49164

Unit testing ionic modules like ionic popover

$
0
0

@Brock01 wrote:

I have the following function in my controller:

function setupMenuPopover() {
      $ionicPlatform.ready(function () {
        $ionicPopover.fromTemplateUrl('views/menu-popover.html', {
          scope: $scope
        }).then(function (popover) {
          vm.menuPopover = popover;
        });
      });
    }

How can I test this with karma?

Currently I have something like:

it('this.setupMenuPopover should setup the menu popover', inject(function(_$ionicPopover_){
      var popup = spyOn(_$ionicPopover_, 'fromTemplateUrl').and.callThrough();

      HomeController.setupMenuPopover();

      expect(popup).toHaveBeenCalled();
      //expect(HomeController.menuPopover).not.toBeNull() <-- returns false, while it should be true.
    }));

Thanks in advance!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49164

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>