Sha256: d10497674571c58c94b266adae117fea079e4a6a8d8c899f2c20c41f89dd74a5

Contents?: true

Size: 887 Bytes

Versions: 72

Compression:

Stored size: 887 Bytes

Contents

require "helper"

module Nokogiri
  module XML
    class TestNodeAttributes < Nokogiri::TestCase
      def test_attribute_with_ns
        doc = Nokogiri::XML <<-eoxml
          <root xmlns:tlm='http://tenderlovemaking.com/'>
            <node tlm:foo='bar' foo='baz' />
          </root>
        eoxml

        node = doc.at('node')

        assert_equal 'bar',
          node.attribute_with_ns('foo', 'http://tenderlovemaking.com/').value
      end

      def test_namespace_key?
        doc = Nokogiri::XML <<-eoxml
          <root xmlns:tlm='http://tenderlovemaking.com/'>
            <node tlm:foo='bar' foo='baz' />
          </root>
        eoxml

        node = doc.at('node')

        assert node.namespaced_key?('foo', 'http://tenderlovemaking.com/')
        assert node.namespaced_key?('foo', nil)
        assert !node.namespaced_key?('foo', 'foo')
      end
    end
  end
end

Version data entries

72 entries across 72 versions & 15 rubygems

Version Path
revo-nokogiri-1.4.0-java test/xml/test_node_attributes.rb
revo-nokogiri-1.4.0.20100202165440-java test/xml/test_node_attributes.rb
nokogiri-1.4.1-x86-mswin32 test/xml/test_node_attributes.rb
nokogiri-1.4.1-x86-mingw32 test/xml/test_node_attributes.rb
nokogiri-1.4.1-java test/xml/test_node_attributes.rb
nokogiri-1.4.1 test/xml/test_node_attributes.rb
superfeedr-nokogiri-1.4.0.20091116183308 test/xml/test_node_attributes.rb
caring-nokogiri-1.4.1.pre1 test/xml/test_node_attributes.rb
nokogiri-1.4.0-java test/xml/test_node_attributes.rb
nokogiri-1.4.0-x86-mswin32 test/xml/test_node_attributes.rb
nokogiri-1.4.0-x86-mingw32 test/xml/test_node_attributes.rb
nokogiri-1.4.0 test/xml/test_node_attributes.rb