mirror of https://gitee.com/bigwinds/arangodb
Made domObserver tests work with PhantomJS. Added to automatic tests
This commit is contained in:
parent
fed5b288e5
commit
4ec105f5e9
|
@ -35,6 +35,9 @@ function DomObserverFactory() {
|
|||
var Constructor = window.WebKitMutationObserver || window.MutationObserver;
|
||||
|
||||
this.createObserver = function(callback) {
|
||||
if (!Constructor) {
|
||||
throw "Observer not supported";
|
||||
}
|
||||
return new Constructor(callback);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ module.exports = function(karma) {
|
|||
|
||||
// GraphViewer
|
||||
'test/specs/graphViewer/specColourMapper/colourMapperSpec.js',
|
||||
// 'test/specs/graphViewer/specWindowObjects/domObserverFactorySpec.js',
|
||||
'test/specs/graphViewer/specWindowObjects/domObserverFactorySpec.js',
|
||||
'test/specs/graphViewer/specCommunityNode/communityNodeSpec.js',
|
||||
'test/specs/graphViewer/specAdapter/interfaceSpec.js',
|
||||
'test/specs/graphViewer/specAdapter/abstractAdapterSpec.js',
|
||||
|
|
|
@ -42,8 +42,16 @@
|
|||
it('should create a Mutation Observer Instance', function() {
|
||||
// First is Firefox, Second is Chrome and Safari
|
||||
var Observer = window.MutationObserver || window.WebKitMutationObserver,
|
||||
factory = new DomObserverFactory();
|
||||
expect(factory.createObserver(function() {})).toEqual(jasmine.any(Observer));
|
||||
factory = new DomObserverFactory(),
|
||||
agent = window.navigator.userAgent;
|
||||
if (agent.match(/PhantomJS/)) {
|
||||
// Fake for PhantomJS. Should not be reached for other browsers
|
||||
expect(function() {
|
||||
factory.createObserver(function() {});
|
||||
}).toThrow("Observer not supported");
|
||||
return;
|
||||
}
|
||||
expect(factory.createObserver(function() {})).toEqual(jasmine.any(Observer));
|
||||
});
|
||||
|
||||
it('should propagate the callback to the MutationObserver', function() {
|
||||
|
|
Loading…
Reference in New Issue