Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7873: selector_tests.diff

File selector_tests.diff, 1.2 kB (added by savetheclocktower, 1 year ago)

A couple more tests for an+b cases

  • test/unit/selector.html

    old new  
    298298      assertEnumEqual([$('link_2')], $$('#p *:nth-last-child(2)'), 'nth-last-child'); 
    299299      assertEnumEqual([$('link_2')], $$('#p *:nth-child(3)'), 'nth-child'); 
    300300      assertEnumEqual([$('link_2')], $$('#p a:nth-child(3)'), 'nth-child'); 
     301      assertEnumEqual($('item_2', 'item_3'), $$('#list > li:nth-child(n+2)')); 
     302      assertEnumEqual($('item_1', 'item_2'), $$('#list > li:nth-child(-n+2)')); 
    301303      $RunBenchmarks && wait(500, function() { 
    302304        benchmark(function() { $$('#level1 *:first-child') }, 1000, ':first-child'); 
    303305        benchmark(function() { $$('#level1 *:last-child') }, 1000, ':last-child'); 
     
    346348      assertEnumEqual($$('ul > li:first-child'), $$('ul > li:nth-child(1)')); 
    347349      assertEnumEqual($$('ul > li:last-child'), $$('ul > li:nth-last-child(1)')); 
    348350      assertEnumEqual($$('#troubleForm *:enabled'), $$('#troubleForm *:not(:disabled)')); 
     351      assertEnumEqual($$('ul > li:nth-child(n-999)'), $$('ul > li')); 
    349352    }}, 
    350353     
    351354    testSelectorsThatShouldReturnNothing: function() {with(this) {