Closed cj closed 7 years ago
At runtime, we don't have access to the filesystem. One alternative option is to use a .haml
or .erb
file, which are already supported in the build system, and add a helper which renders those templates and adds them to the DOM.
@adambeynon so I already have an index.html.erb file:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<%= javascript_include_tag 'public/vendor/jquery/jquery' %>
<%= javascript_include_tag 'bower_components/fine-uploader/_build/s3.jquery.fine-uploader' %>
<%= javascript_include_tag @server.main %>
</body>
</html>
using:
Opal::RSpec::RakeTask.new('opal:rspec') do |s|
s.index_path = 'spec/index.html.erb'
end
So are you talking about adding a helper like javascript_include_tag
? If so would you be able to handle an html file per test? Maybe linking the name of the test file to an html file? i.e.
load_html({
'uploader_spec' => 'public/uploader.html'
})
@cj did you resolve this somehow?
Would there be anyway to grab the contents from a file and add a method like
html_file
https://github.com/opal/opal-jquery/blob/6d864fb0dfa0a5cd399f1a46bfa2e24fcb257768/lib/opal/jquery/rspec.rb#L50 ?