Clean up changes from PR #174

This commit is contained in:
Yorick Peterse 2017-04-18 12:55:11 +02:00
parent 4250033ed5
commit 84c4db3e9f
No known key found for this signature in database
GPG Key ID: EDD30D2BEB691AC9
2 changed files with 17 additions and 13 deletions

View File

@ -3,12 +3,13 @@
This document contains details of the various releases and their release dates. This document contains details of the various releases and their release dates.
Dates are in the format `yyyy-mm-dd`. Dates are in the format `yyyy-mm-dd`.
## Unreleased ## 2.10 - 2017-04-18
### Fix `Element#attribute` result for HTML doc when `Symbol` passed as name ### Fix `Element#attribute` for HTML documents when using Symbol arguments
Using `Symbol` is working for XML doc, but was not working for HTML doc. You can now pass a Symbol to `Oga::XML::Element#attribute` for both XML and HTML
See [PR #174](https://github.com/YorickPeterse/oga/pull/174) documents, previously this only worked for XML documents. See [PR
#174](https://github.com/YorickPeterse/oga/pull/174) for more information.
## 2.9 - 2017-02-10 ## 2.9 - 2017-02-10

View File

@ -107,25 +107,28 @@ describe Oga::XML::Element do
end end
describe 'using an HTML document' do describe 'using an HTML document' do
let!(:attr) do let(:attr) do
Oga::XML::Attribute.new(:name => 'foo:bar', :value => 'foo') Oga::XML::Attribute.new(name: 'foo:bar', value: 'foo')
end end
let!(:el) do
described_class.new(:name => 'foo', :attributes => [attr]) let(:el) do
end el = described_class.new(name: 'foo', attributes: [attr])
let!(:doc) do Oga::XML::Document.new(children: [el], type: :html)
Oga::XML::Document.new(:children => [el], :type => :html)
el
end end
it 'returns an attribute with a name containing a namespace separator' do it 'returns an attribute with a name containing a namespace separator' do
el.attribute('foo:bar').should == attr el.attribute('foo:bar').should == attr
end end
it 'returns an attribute with a name containing a namespace separator when using a Symbol' do describe 'using a Symbol argument' do
it 'returns the attribute' do
el.attribute(:'foo:bar').should == attr el.attribute(:'foo:bar').should == attr
end end
end end
end end
end
describe '#get' do describe '#get' do
before do before do