Permalink
Browse files

Added tests

  • Loading branch information...
1 parent 8d8500e commit 7edab1c6deb0b58db7a55ea5f0c30cd9a4d05210 Nicholas C. Zakas committed Nov 28, 2011
Showing with 36 additions and 6 deletions.
  1. +2 −2 build/node-parserlib.js
  2. +1 −1 build/parserlib-core.js
  3. +1 −1 build/parserlib-css.js
  4. +15 −0 build/parserlib-tests.js
  5. +2 −2 build/parserlib.js
  6. +15 −0 tests/css/Parser.js
View
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 28-November-2011 12:16:03 */
+/* Version v@VERSION@, Build time: 28-November-2011 12:19:00 */
var parserlib = {};
(function(){
@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 28-November-2011 12:16:03 */
+/* Version v@VERSION@, Build time: 28-November-2011 12:19:00 */
(function(){
var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase,
View
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 28-November-2011 12:16:03 */
+/* Version v@VERSION@, Build time: 28-November-2011 12:19:00 */
var parserlib = {};
(function(){
View
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 28-November-2011 12:16:03 */
+/* Version v@VERSION@, Build time: 28-November-2011 12:19:00 */
(function(){
var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase,
View
@@ -1466,6 +1466,21 @@
var result = parser.parse(".foo {\n color: #fff;\n}");
},
+ "Test rule with space after property name": function(){
+ var parser = new Parser({ strict: true});
+ parser.addListener("property", function(event){
+ Assert.areEqual("color", event.property.toString());
+ Assert.areEqual("#fff", event.value.toString());
+ Assert.areEqual(5, event.property.col, "Property column should be 5.");
+ Assert.areEqual(2, event.property.line, "Property line should be 2.");
+ Assert.areEqual(5, event.col, "Event column should be 5.");
+ Assert.areEqual(2, event.line, "Event line should be 2.");
+ Assert.areEqual(13, event.value.parts[0].col, "First part column should be 12.");
+ Assert.areEqual(2, event.value.parts[0].line, "First part line should be 2.");
+ });
+ var result = parser.parse(".foo {\n color : #fff;\n}");
+ },
+
"Test rule with one property and !important": function(){
var parser = new Parser({ strict: true});
parser.addListener("property", function(event){
View
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 28-November-2011 12:16:03 */
+/* Version v@VERSION@, Build time: 28-November-2011 12:19:00 */
var parserlib = {};
(function(){
@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Version v@VERSION@, Build time: 28-November-2011 12:16:03 */
+/* Version v@VERSION@, Build time: 28-November-2011 12:19:00 */
(function(){
var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase,
View
@@ -1466,6 +1466,21 @@
var result = parser.parse(".foo {\n color: #fff;\n}");
},
+ "Test rule with space after property name": function(){
+ var parser = new Parser({ strict: true});
+ parser.addListener("property", function(event){
+ Assert.areEqual("color", event.property.toString());
+ Assert.areEqual("#fff", event.value.toString());
+ Assert.areEqual(5, event.property.col, "Property column should be 5.");
+ Assert.areEqual(2, event.property.line, "Property line should be 2.");
+ Assert.areEqual(5, event.col, "Event column should be 5.");
+ Assert.areEqual(2, event.line, "Event line should be 2.");
+ Assert.areEqual(13, event.value.parts[0].col, "First part column should be 12.");
+ Assert.areEqual(2, event.value.parts[0].line, "First part line should be 2.");
+ });
+ var result = parser.parse(".foo {\n color : #fff;\n}");
+ },
+
"Test rule with one property and !important": function(){
var parser = new Parser({ strict: true});
parser.addListener("property", function(event){

0 comments on commit 7edab1c

Please sign in to comment.