Sha256: 0e503595eb10f922e3c39cdc515a411f6452f1e0a4b5e3921d11047a7ec7664a

Contents?: true

Size: 912 Bytes

Versions: 3

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

# This is a temporary fix to ignore some HTML/CSS validation issues with the
# Decidim HTML validation process.
#
# See: https://github.com/decidim/decidim/issues/8596
# Related: https://github.com/w3c/css-validator/issues/355
module W3CValidators
  class NuValidator
    protected

    alias validate_nu validate unless method_defined?(:validate_nu)

    def validate(options) # :nodoc:
      filter_results(validate_nu(options))
    end

    def ignore_errors
      @ignore_errors ||= [
        "CSS: “--content-height”: One operand must be a number."
      ]
    end

    def filter_results(results)
      messages = results.instance_variable_get(:@messages)
      messages.delete_if do |msg|
        msg.is_error? && ignore_errors.include?(msg.message)
      end
      results.instance_variable_set(:@validity, messages.none?(&:is_error?))

      results
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-dev-0.26.0 lib/decidim/dev/test/w3c_rspec_validators_overrides.rb
decidim-dev-0.26.0.rc2 lib/decidim/dev/test/w3c_rspec_validators_overrides.rb
decidim-dev-0.26.0.rc1 lib/decidim/dev/test/w3c_rspec_validators_overrides.rb