# frozen_string_literal: true require_relative "test_helper" module SassC class CustomImporterTest < MiniTest::Test include TempFileTest class CustomImporter < Importer def imports(path, parent_path) if path =~ /styles/ [ Import.new("#{path}1.scss", source: "$var1: #000;"), Import.new("#{path}2.scss") ] else Import.new(path) end end end class NoFilesImporter < Importer def imports(path, parent_path) [] end end class OptionsImporter < Importer def imports(path, parent_path) Import.new("name.scss", source: options[:custom_option_source]) end end class ParentImporter < Importer def imports(path, parent_path) Import.new("name.scss", source: ".#{parent_path} { color: red; }") end end def test_custom_importer_works temp_file("styles2.scss", ".hi { color: $var1; }") temp_file("fonts.scss", ".font { color: $var1; }") data = <