JavaScript not.custom_matcher error - Jasmine

I have created a custom matcher in jasmine to verify if an element has a class or not. This is the code that I have placed in the beforeEach() function to define the custom matcher:

beforeEach(function() {

    jasmine.addMatchers({
        toHaveClass: function() {
            return {
                compare: function(actual, expected) {
                    return {
                        pass: actual.getAttribute('class').then(function(classes) {
                            return classes.split(' ').indexOf(expected) !== -1;
                        })
                    }
                }
            }
        }
    });

    this.driver = new webdriver.Builder().forBrowser('firefox').build();
    this.driver.manage().window().maximize();
    this.driver.get('http://localhost:8000/');
});

Then in the it function toHaveClass works properly, but when I combine it with the .not method, I get a really weird mistake. This is the part of the code where I am having the error:

it('should not create conflicts between the headers', function() { 
    this.driver.manage().window().setSize(767, 632);
    this.driver.findElement(webdriver.By.className('navbar-toggle')).click();
    var headerBar = this.driver.findElement(webdriver.By.className('navbar-collapse'));
    this.driver.manage().window().setSize(1000, 632).then(function() {
        expect(headerBar).not.toHaveClass('in');      
    });
});

Do you know what could be the issue that causes the test to crash? Thanks in advance for your replies!

Answer:1

I'm trying to make an advanced <select> tag but implementing an input before the first <option> attribute for searching. Something like this: Here is my code. How can I add <input name=...

I'm trying to make an advanced <select> tag but implementing an input before the first <option> attribute for searching. Something like this: Here is my code. How can I add <input name=...

I'm using angularjs for my application and found this issue on google chrome, the problem is I have this URL: http://127.0.0.1/#/fa/episode/1315019/برنامه-خوب but when I click on this links it shows:...

I'm using angularjs for my application and found this issue on google chrome, the problem is I have this URL: http://127.0.0.1/#/fa/episode/1315019/برنامه-خوب but when I click on this links it shows:...

I am using React/Redux for my web-app and I have the Description Class where user can edit description. Props description and propertyTypes are coming from AJAX calls. import React, { PropTypes } ...

I am using React/Redux for my web-app and I have the Description Class where user can edit description. Props description and propertyTypes are coming from AJAX calls. import React, { PropTypes } ...

  1. update nested value javascript
  2. mongodb update nested value
  3. jq update nested value
  4. redux update nested value
  5. update nested value
  6. python json update nested value
  7. react state update nested value
  8. python dictionary update nested value
  9. update value in nested list c#
  10. update value of nested dictionary
  11. update value in nested dict python

I know, the title isn't really specific, but I have a problem with DatePicker. I try to disable the national days, weekend and 48 hours after today. For the moment I did this : Hide today + 48hours, ...

I know, the title isn't really specific, but I have a problem with DatePicker. I try to disable the national days, weekend and 48 hours after today. For the moment I did this : Hide today + 48hours, ...

  1. jquery datepicker disable national holidays