mardi 26 juin 2018

Error: document is not defined

I have this html button:

 <button id="ref_button" type="submit" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
           

And I want to test if it is disabled in a special case using Chai. I do all the previous part, putting data in the from and now expect that this button to be disables like this:

  const chai = require('chai');
      const expect  = chai.expect;
     expect(document.getElementById('ref_button')).to.have.attr('disabled');

The erro that I get is docuemntis not defined. Is there something I do wrong? I am based here: enter link description here

Aucun commentaire:

Enregistrer un commentaire