This isn't comprehensive but it should be broad enough to ensure that most people who would be affected by blocking monkey patching see a warning. Covers the jasmine namespace as well as classes that are monkey patched by zone.js. Replacing globals (describe/it/etc) doesn't trigger a warning because they belong to the user and are expected to be replaced.
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
describe('HtmlSpecFilter', function() {
|
|
let env, deprecator;
|
|
|
|
beforeEach(function() {
|
|
deprecator = jasmine.createSpyObj('deprecator', [
|
|
'verboseDeprecations',
|
|
'addDeprecationWarning'
|
|
]);
|
|
env = new privateUnderTest.Env({ deprecator });
|
|
});
|
|
|
|
afterEach(function() {
|
|
env.cleanup_();
|
|
});
|
|
|
|
it('emits a deprecation warning', function() {
|
|
new jasmineUnderTest.HtmlSpecFilter({ env });
|
|
expect(deprecator.addDeprecationWarning).toHaveBeenCalledWith(
|
|
jasmine.anything(),
|
|
'HtmlReporter and HtmlSpecFilter are deprecated. Use HtmlReporterV2 instead.',
|
|
undefined
|
|
);
|
|
});
|
|
|
|
it('should match when no string is provided', function() {
|
|
const specFilter = new jasmineUnderTest.HtmlSpecFilter({ env });
|
|
|
|
expect(specFilter.matches('foo')).toBe(true);
|
|
expect(specFilter.matches('*bar')).toBe(true);
|
|
});
|
|
|
|
it('should only match the provided string', function() {
|
|
const specFilter = new jasmineUnderTest.HtmlSpecFilter({
|
|
env,
|
|
filterString: function() {
|
|
return 'foo';
|
|
}
|
|
});
|
|
|
|
expect(specFilter.matches('foo')).toBe(true);
|
|
expect(specFilter.matches('bar')).toBe(false);
|
|
});
|
|
});
|