Sha256: 04d6a95fc61963a84a95e4d690d05e48fdf75603c6161958a49e2a1e605b14bb

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

require "test/helper"
require "osheet/style_set"

module Osheet
  class StyleSetTest < Test::Unit::TestCase

    context "Osheet::StyleSet" do
      subject { StyleSet.new }

      should "be an Array" do
        assert_kind_of ::Array, subject
      end

      should_have_reader :for

      should "verify Template objs" do
        assert_raises ArgumentError do
          subject.send(:verify, {})
        end
        assert_nothing_raised do
          subject.send(:verify, Style.new('.awesome') {})
        end
      end

      should "be able to lookup styles by class" do
        subject << (a = Style.new('.awesome') {})
        subject << (at = Style.new('.awesome.thing') {})
        subject << (b = Style.new('.boring') {})
        subject << (bt = Style.new('.boring.thing') {})
        subject << (a_b = Style.new('.awesome', '.boring') {})
        subject << (t = Style.new('.thing') {})
        subject << (s = Style.new('.stupid') {})

        { 'awesome' => [a, a_b],
          'boring' => [b, a_b],
          'thing' => [t],
          'awesome thing' => [a, at, a_b, t],
          'thing awesome' => [a, at, a_b, t],
          'other' => []
        }.each do |style_class, styles_set|
          if style_class == 'awesome'
            assert_equal styles_set, subject.for(style_class)
          end
        end
      end

    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
osheet-0.7.0 test/style_set_test.rb
osheet-0.6.0 test/style_set_test.rb
osheet-0.5.0 test/style_set_test.rb
osheet-0.4.0 test/style_set_test.rb
osheet-0.3.0 test/style_set_test.rb
osheet-0.2.0 test/style_set_test.rb