Skip to content

Commit

Permalink
Fix Validator tests on Travis, which now uses Node v4 (ampproject#9654)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha authored and Aaron Turner committed Jun 6, 2017
1 parent a7d06ef commit b4f6729
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions validator/engine/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ class ChildTagMatcher {
this.numChildTagsSeen_++; // Increment this first to allow early exit.
if (childTags.childTagNameOneof.length > 0) {
const names = childTags.childTagNameOneof;
if (!names.includes(tagName)) {
if (names.indexOf(tagName) === -1) {
if (!amp.validator.LIGHT) {
const allowedNames = '[\'' + names.join('\', \'') + '\']';
context.addError(
Expand All @@ -859,7 +859,7 @@ class ChildTagMatcher {
if (childTags.firstChildTagNameOneof.length > 0 &&
(this.numChildTagsSeen_ - 1) === 0) {
const names = childTags.firstChildTagNameOneof;
if (!names.includes(tagName)) {
if (names.indexOf(tagName) === -1) {
if (!amp.validator.LIGHT) {
const allowedNames = '[\'' + names.join('\', \'') + '\']';
context.addError(
Expand Down Expand Up @@ -2806,7 +2806,7 @@ function validateLayout(parsedTagSpec, context, attrsByKey, result) {
}

// Does the tag support the computed layout?
if (!spec.ampLayout.supportedLayouts.includes(layout)) {
if (spec.ampLayout.supportedLayouts.indexOf(layout) === -1) {
if (amp.validator.LIGHT) {
result.status = amp.validator.ValidationResult.Status.FAIL;
} else {
Expand Down Expand Up @@ -3296,7 +3296,7 @@ function validateAttributes(
// The "at least 1" part of mandatory_oneof: If none of the
// alternatives were present, we report that an attribute is missing.
for (const mandatoryOneof of parsedTagSpec.getMandatoryOneofs()) {
if (!mandatoryOneofsSeen.includes(mandatoryOneof)) {
if (mandatoryOneofsSeen.indexOf(mandatoryOneof) === -1) {
if (amp.validator.LIGHT) {
result.status = amp.validator.ValidationResult.Status.FAIL;
return;
Expand Down Expand Up @@ -3982,7 +3982,7 @@ class ParsedValidatorRules {
continue;
}
const alternative = tagSpec.mandatoryAlternatives;
if (!satisfied.includes(alternative)) {
if (satisfied.indexOf(alternative) === -1) {
if (amp.validator.LIGHT) {
validationResult.status = amp.validator.ValidationResult.Status.FAIL;
return;
Expand Down

0 comments on commit b4f6729

Please sign in to comment.