Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Validator smoke tests on Travis, which now uses Node v4 #9654

Merged
merged 1 commit into from
May 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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