Sha256: ccc23917dd4cb2213030e159e1eca307e67b6afcc72dc5209931661198894f10

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

include AlchemyHelper

describe ElementsHelper do

	before(:each) do
		@page = Factory(:public_page)
	  @element = Factory(:element, :page => @page)
	end

  it "should render an element view partial" do
		helper.render_element(@element).should match(/class="article".+id="article_6"/)
  end

	it "should render all elements" do
		@another_element = Factory(:element)
		helper.stub!(:configuration).and_return(true)
		helper.render_elements.should match(/id="header_3.+id="article_5"/)
	end 

	it "should render a unique dom id for element" do
	  helper.element_dom_id(@element).should == "#{@element.name}_#{@element.id}"
	end

	context "in preview mode" do

	  it "should return the data-alchemy-element HTML attribute for element" do
			@preview_mode = true
		  helper.element_preview_code(@element).should == " data-alchemy-element='#{@element.id}'"
		end

		it "should not return the data-alchemy-element HTML attribute if not in preview_mode" do
		  helper.element_preview_code(@element).should_not == " data-alchemy-element='#{@element.id}'"
		end

	end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alchemy_cms-2.0.rc6 spec/helpers/elements_helper_spec.rb
alchemy_cms-2.0.rc5 spec/helpers/elements_helper_spec.rb
alchemy_cms-2.0.rc4 spec/helpers/elements_helper_spec.rb