Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #30 from mirceapiturca/master

MediaQuery.text minor bug
  • Loading branch information...
commit 172a2b2338078d7e23fd6655b926aaf3da26e449 2 parents 4c2d521 + a66dfbd
@nzakas nzakas authored
View
2  build/node-parserlib.js
@@ -1169,7 +1169,7 @@ MediaFeature.prototype.constructor = MediaFeature;
*/
function MediaQuery(modifier, mediaType, features, line, col){
- SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType + " " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
+ SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
/**
* The media modifier ("not" or "only")
View
2  src/css/MediaQuery.js
@@ -13,7 +13,7 @@
*/
function MediaQuery(modifier, mediaType, features, line, col){
- SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType + " " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
+ SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
/**
* The media modifier ("not" or "only")
View
5 tests/css/Parser.js
@@ -891,6 +891,7 @@
Assert.isNull(result.modifier);
Assert.areEqual("print", result.mediaType);
Assert.areEqual(0, result.features.length, "Should be zero parts.");
+ Assert.areEqual("print", result.text);
},
testSimpleMediaQueryNot: function(){
@@ -903,6 +904,7 @@
Assert.areEqual("not", result.modifier);
Assert.areEqual("print", result.mediaType);
Assert.areEqual(0, result.features.length, "Should be zero parts.");
+ Assert.areEqual("not print", result.text);
},
testSimpleMediaQueryOnly: function(){
@@ -915,6 +917,7 @@
Assert.areEqual("only", result.modifier);
Assert.areEqual("print", result.mediaType);
Assert.areEqual(0, result.features.length, "Should be zero parts.");
+ Assert.areEqual("only print", result.text);
},
testComplexMediaQuery: function(){
@@ -933,6 +936,7 @@
Assert.areEqual("color", result.features[1].name);
Assert.isNull(result.features[1].value);
Assert.areEqual(35, result.features[1].name.col);
+ Assert.areEqual("screen and (max-weight: 3kg) and (color)", result.text);
},
@@ -950,6 +954,7 @@
Assert.areEqual("768px", result.features[0].value);
Assert.areEqual("orientation", result.features[1].name);
Assert.areEqual("portrait", result.features[1].value);
+ Assert.areEqual("only screen and (max-device-width: 768px) and (orientation:portrait)", result.text);
}

0 comments on commit 172a2b2

Please sign in to comment.
Something went wrong with that request. Please try again.