Allow tests to be ignored by feature
This commit is contained in:
+2
-1
@@ -6,6 +6,7 @@
|
|||||||
"afterLoadText": false,
|
"afterLoadText": false,
|
||||||
"expect": false,
|
"expect": false,
|
||||||
"proj4": false,
|
"proj4": false,
|
||||||
"sinon": false
|
"sinon": false,
|
||||||
|
"where": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ var green = 'data:image/gif;base64,R0lGODlhAQABAPAAAAD/AP///yH5BAAAAAAALAAAA' +
|
|||||||
var blue = 'data:image/gif;base64,R0lGODlhAQABAPAAAAAA/////yH5BAAAAAAALAAAAA' +
|
var blue = 'data:image/gif;base64,R0lGODlhAQABAPAAAAAA/////yH5BAAAAAAALAAAAA' +
|
||||||
'ABAAEAAAICRAEAOw==';
|
'ABAAEAAAICRAEAOw==';
|
||||||
|
|
||||||
describe('ol.source.Raster', function() {
|
where('Uint8ClampedArray').describe('ol.source.Raster', function() {
|
||||||
|
|
||||||
var target, map, redSource, greenSource, blueSource, raster;
|
var target, map, redSource, greenSource, blueSource, raster;
|
||||||
|
|
||||||
|
|||||||
@@ -458,4 +458,25 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var features = {
|
||||||
|
Uint8ClampedArray: ('Uint8ClampedArray' in global)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow tests to be skipped where certain features are not available. The
|
||||||
|
* provided key must be in the above `features` lookup. Keys should
|
||||||
|
* correspond to the feature that is required, but can be any string.
|
||||||
|
* @param {string} key The required feature name.
|
||||||
|
* @return {Object} An object with a `describe` function that will run tests
|
||||||
|
* if the required feature is available and skip them otherwise.
|
||||||
|
*/
|
||||||
|
global.where = function(key) {
|
||||||
|
if (!(key in features)) {
|
||||||
|
throw new Error('where() called with unknown key: ' + key);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
describe: features[key] ? global.describe : global.xdescribe
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
})(this);
|
})(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user