Fixed AST for :only-of-type
This commit is contained in:
		
							parent
							
								
									1c301d40e2
								
							
						
					
					
						commit
						9eead81a7c
					
				|  | @ -581,7 +581,7 @@ end | ||||||
|   # @return [AST::Node] |   # @return [AST::Node] | ||||||
|   # |   # | ||||||
|   def on_pseudo_class_only_of_type |   def on_pseudo_class_only_of_type | ||||||
|     return s(:eq, s(:call, 'last'), s(:int, 1)) |     return s(:and, on_pseudo_class_first_of_type, on_pseudo_class_last_of_type) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ## |   ## | ||||||
|  |  | ||||||
|  | @ -4,7 +4,15 @@ describe Oga::CSS::Parser do | ||||||
|   context ':only-of-type pseudo class' do |   context ':only-of-type pseudo class' do | ||||||
|     example 'parse the :only-of-type pseudo class' do |     example 'parse the :only-of-type pseudo class' do | ||||||
|       parse_css(':only-of-type').should == parse_xpath( |       parse_css(':only-of-type').should == parse_xpath( | ||||||
|         'descendant::*[last() = 1]' |         'descendant::*[count(preceding-sibling::*) = 0 and ' \ | ||||||
|  |           'count(following-sibling::*) = 0]' | ||||||
|  |       ) | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     example 'parse the a:only-of-type pseudo class' do | ||||||
|  |       parse_css('a:only-of-type').should == parse_xpath( | ||||||
|  |         'descendant::a[count(preceding-sibling::a) = 0 and ' \ | ||||||
|  |           'count(following-sibling::a) = 0]' | ||||||
|       ) |       ) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue