Sha256: ded731945f7c40f0228faf9d6447c3de53227d130cd15d68bac58d03b2375b24
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
# -*- encoding : utf-8 -*- require 'spec_helper' include Dima::Html describe 'Anchor' do before(:all) do @a = Node.new(tag: 'a', attributes: { href: 'http://c12.ge' }, text: 'Our site') end subject { @a.html } it { should == '<a href="http://c12.ge">Our site</a>' } end describe 'Nested nodes' do before(:all) do @div = Node.new(tag: 'div') @div[:class] = 'links' @div << Node.new(tag: 'a', attributes: { href: 'http://c12.ge' }, text: 'Our site') end subject { @div.html } it { should == '<div class="links"><a href="http://c12.ge">Our site</a></div>' } specify { @div[:class].should == 'links' } specify { @div[:style].should be_nil } end describe 'Boolean attributes' do before(:all) do @n1 = Node.new(tag: 'input', attributes: { type: 'checkbox', checked: true }) @n2 = Node.new(tag: 'input', attributes: { type: 'checkbox', checked: false }) end specify { @n1.html.should == '<input type="checkbox" checked></input>' } specify { @n2.html.should == '<input type="checkbox"></input>' } end describe 'Class management' do before(:all) do @div = Node.new(tag: 'div') @div.add_class('class-1') @div.add_class('class-2') end subject { @div.html } it { should == '<div class="class-1 class-2"></div>' } end
Version data entries
6 entries across 6 versions & 1 rubygems