vendredi 1 mars 2019

mock data for this.$el for unit this with karma

I want to create a unit test for the following code with Karma.

       if (!this.$el.contains(e.target)) {
            this.isActive = false;
        }

How can I mock the data from the if statement to get the return back?

   describe('removeClass()', () => {
        it('should return false', () => {
            vm.removeClass();
            expect(vm.isActive).toBe(false);
        });
    });

Aucun commentaire:

Enregistrer un commentaire