prototypejs / prototype

Prototype JavaScript framework
http://prototypejs.org/
Other
3.54k stars 639 forks source link

PATCH: UNIT TEST: SELECTOR TEST #269

Closed jwestbrook closed 9 years ago

jwestbrook commented 9 years ago

previous lighthouse ticket #1312 by Ismail Jones


I fixed an error with the testSelectorWithNot in test/unit/selector_test.js.

This was failing in FF 3.6 and Opera 11 with a css selector error. There was an extra element ('a') in the selector. I changed $$('#p a:not(a:first-of-type)') to $$('#p a:not(:first-of-type)') by removing the 'a'. Now this test passes in both browsers. I did not test other browsers.

Sorry about the patch description... I copied from the prototype site and pasted with the carriage return :-)

Thanks this is my first patch.

Peace

From e64c18d8f0d57b62415fc903ae19a3105c94b8ee Mon Sep 17 00:00:00 2001
From: unknown <ismail.jones@MOKANSASC5DS87.aglo.one.usda.gov>
Date: Fri, 13 Jan 2012 16:58:29 -0600
Subject: [PATCH] fixed a bug regarding the DOM

---
 test/unit/selector_test.js |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/unit/selector_test.js b/test/unit/selector_test.js
index 56c730c..55e8720 100644
--- a/test/unit/selector_test.js
+++ b/test/unit/selector_test.js
@@ -270,10 +270,10 @@ new Test.Unit.Runner({
   },

   testSelectorWithNot: function() {
-    this.assertEnumEqual([$('link_2')], $$('#p a:not(a:first-of-type)'), 'first-of-type');
-    this.assertEnumEqual([$('link_1')], $$('#p a:not(a:last-of-type)'), 'last-of-type');
-    this.assertEnumEqual([$('link_2')], $$('#p a:not(a:nth-of-type(1))'), 'nth-of-type');
-    this.assertEnumEqual([$('link_1')], $$('#p a:not(a:nth-last-of-type(1))'), 'nth-last-of-type');
+    this.assertEnumEqual([$('link_2')], $$('#p a:not(:first-of-type)'), 'first-of-type');
+    this.assertEnumEqual([$('link_1')], $$('#p a:not(:last-of-type)'), 'last-of-type');
+    this.assertEnumEqual([$('link_2')], $$('#p a:not(:nth-of-type(1))'), 'nth-of-type');
+    this.assertEnumEqual([$('link_1')], $$('#p a:not(:nth-last-of-type(1))'), 'nth-last-of-type');
     this.assertEnumEqual([$('link_2')], $$('#p a:not([rel~=nofollow])'), 'attribute 1');
     this.assertEnumEqual([$('link_2')], $$('#p a:not(a[rel^=external])'), 'attribute 2');
     this.assertEnumEqual([$('link_2')], $$('#p a:not(a[rel$=nofollow])'), 'attribute 3');
-- 
1.7.8.msysgit.0
savetheclocktower commented 9 years ago

These seem to pass in recent FF and Opera.