Sha256: 3e8548248ae64d73906a05e089058c269123513c82fb49bed1e11d016ac808eb

Contents?: true

Size: 1.76 KB

Versions: 2

Compression:

Stored size: 1.76 KB

Contents

# require 'spec_helper'
require File.dirname(__FILE__) + '/../spec_helper'

describe "Javascript Tags" do
  dataset :javascripts

  let(:page){ pages(:home) }
    let(:javascript_page){ pages(:site_js)}

  describe "<r:javascript>" do
    subject { page }
    it { should render(%{<r:javascript />}).with_error("`javascript' tag must contain a `slug' attribute.") }
    it { should render(%{<r:javascript slug="bogus" />}).with_error("javascript bogus not found") }
    it { should render(%{<r:javascript slug="site.js" />}).as('alert("site!");') }
    it { should render(%{<r:javascript slug="site.js" as="url" />}).as("/js/site.js?#{javascript_page.digest}") }
    it { should render(%{<r:javascript slug="site.js" as="link" />}).as(%{<script type="#{javascript_page.headers['Content-Type']}" src="#{javascript_page.path}"></script>}) }
    it { should render(%{<r:javascript slug="site.js" as="link" type="special/type" />}).as(%{<script type="special/type" src="#{javascript_page.path}"></script>}) }
    it { should render(%{<r:javascript slug="site.js" as="link" something="custom" />}).as(%{<script type="#{javascript_page.headers['Content-Type']}" src="#{javascript_page.path}" something="custom"></script>}) }
    it { should render(%{<r:javascript slug="site.js" as="inline" />}).as(%{<script type="#{javascript_page.headers['Content-Type']}">
//<![CDATA[
alert("site!");
//]]>
</script>}) }
    it { should render(%{<r:javascript slug="site.js" as="inline" type="special/type" />}).as(%{<script type="special/type">
//<![CDATA[
alert("site!");
//]]>
</script>}) }
    it { should render(%{<r:javascript slug="site.js" as="inline" something="custom" />}).as(%{<script type="#{javascript_page.headers['Content-Type']}" something="custom">
//<![CDATA[
alert("site!");
//]]>
</script>}) }
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-sheets-extension-1.0.1 spec/lib/javascript_tags_spec.rb
radiant-sheets-extension-1.0.0 spec/lib/javascript_tags_spec.rb