From 5fde2f90926f6a3c8db98b6c5adf626d0c19b1f7 Mon Sep 17 00:00:00 2001
From: Yorick Peterse <yorickpeterse@gmail.com>
Date: Thu, 16 Oct 2014 10:25:30 +0200
Subject: [PATCH] Basic tests for the CSS transformer.

---
 spec/oga/css/transformer/classes_spec.rb | 35 ++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 spec/oga/css/transformer/classes_spec.rb

diff --git a/spec/oga/css/transformer/classes_spec.rb b/spec/oga/css/transformer/classes_spec.rb
new file mode 100644
index 0000000..23f45a3
--- /dev/null
+++ b/spec/oga/css/transformer/classes_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe Oga::CSS::Transformer do
+  context 'classes' do
+    before do
+      @transformer = described_class.new
+    end
+
+    example 'convert a class node without a node test' do
+      @transformer.process(parse_css('.foo')).should == s(
+        :axis,
+        'child',
+        s(
+          :test,
+          nil,
+          '*',
+          s(:eq, s(:axis, 'attribute', s(:test, nil, 'class')), s(:string, 'foo'))
+        )
+      )
+    end
+
+    example 'convert a class node with a node test' do
+      @transformer.process(parse_css('x.foo')).should == s(
+        :axis,
+        'child',
+        s(
+          :test,
+          nil,
+          'x',
+          s(:eq, s(:axis, 'attribute', s(:test, nil, 'class')), s(:string, 'foo'))
+        )
+      )
+    end
+  end
+end