Skip to content

Commit

Permalink
Test allowed_protocol:http and !allow_relative:false
Browse files Browse the repository at this point in the history
  • Loading branch information
honeybadgerdontcare authored and twifkak committed May 21, 2018
1 parent 5b32b6b commit acb2cdf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions validator/engine/validator_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,20 @@ function attrRuleShouldMakeSense(attrSpec, rules) {
}
});
}
// If allowed_protocol is http then allow_relative should not be false
// except for `data-` attributes.
if (!attrSpec.name.startsWith('data-')) {
for (const allowedProtocol of attrSpec.valueUrl.allowedProtocol) {
if ((allowedProtocol === 'http') &&
(attrSpec.valueUrl.allowRelative !== null)) {
it('allow_relative can not be false if allowed_protocol is http: ' +
attrSpec.name,
() => {
expect(attrSpec.valueUrl.allowRelative).toEqual(true);
});
}
}
}
}
if (attrSpec.valueRegex !== null) {
it('value_regex valid', () => {
Expand Down

0 comments on commit acb2cdf

Please sign in to comment.