javascript - Strange behaviour delete keyword phantomjs -


context

I have a code that, via action As a browser, jasmine and phantom, , and my problem is that I do not know why the delete keyword does not work

UPDATE

It really looks like it is not working on it, I have a clear document about an indication or keyword support Search in vain The phantomjs looked on github for. Chrome either now ...

Here is the output expected

An example method of ShopDataServiceTest should not be removed {getModelName: Remove Function}.

Here is my test code:

  // CRUDService basically returns a new class / one prototype method, in which a ShopDataService = CRUDService Has been removed .build (modelName); Delete ShopDataService.prototype.remove;  

Here is the code executed by Karma

  Hopefully (ShopDataService.prototype) .not.toHaveMethod ('Remove');  

Important note

This code is running under code and does not work in that situation, but it's on Chrome

, am I missing something here?


Edit I did not tell it earlier, expression typeof ShopDataService.prototype.remove return 'function' , As has been said.

Well, this is a strange moment when you think the prototype is wrong!

Why me wrong

ShopDataService is simply not to remove its own property, since it has been inherited from the CRUD, the method in its prototype Removes

I had it

  var CRUD = function CRUD (modelName) {this.getModelName = function () {return modelName; }; }; CRUD.prototype = {save: function () {// ABSTRACT}, / ** * Deletes instances from id property * @thurne http promise * / Remove: function () {// call api}};  

And now it works with

  var CRUD = function CRUD (modelName) {this.getModelName = Function () {Return modelName; }; This.save = function () {}; This.remove = function () {}; };  

As a side effect, the CRUD prototype should not be killed to define the removal method, rather it should define the newly created prototype on extended CRUD.


Comments