Skip to content

Commit

Permalink
Add a few tests. Intentionally broke the caniuse links so i will reme…
Browse files Browse the repository at this point in the history
…mber to fill them out. Offline currently.
  • Loading branch information
SlexAxton committed Mar 5, 2013
1 parent 655ddd5 commit c838184
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 29 deletions.
10 changes: 8 additions & 2 deletions feature-detects/css/generatedcontent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/*!
{
"name": "CSS Generated Content",
"property": "generatedcontent",
"tags": ["css"],
"warnings": ["Android won't return correct height for anything below 7px #738"]
}
!*/
define(['Modernizr', 'testStyles'], function( Modernizr, testStyles ) {
// CSS generated content detection
// Android won't return correct height for anything below 7px #738
testStyles('#modernizr{font:0/0 a}#modernizr:after{content:":)";visibility:hidden;font:7px/1 a}', function( node ) {
Modernizr.addTest('generatedcontent', node.offsetHeight >= 7);
});
Expand Down
28 changes: 21 additions & 7 deletions feature-detects/css/gradients.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
/*!
{
"name": "CSS Gradients",
"caniuse": "",LOOKITUP
"property": "cssgradients",
"tags": ["css"],
"notes": [{
"name": "Webkit Gradient Syntax",
"href": "http://webkit.org/blog/175/introducing-css-gradients/"
},{
"name": "Mozilla Linear Gradient Syntax",
"href": "http://developer.mozilla.org/en/CSS/-moz-linear-gradient"
},{
"name": "Mozilla Radial Gradient Syntax",
"href": "http://developer.mozilla.org/en/CSS/-moz-radial-gradient"
},{
"name": "W3C Gradient Spec",
"href": "dev.w3.org/csswg/css3-images/#gradients-"
}]
}
!*/
define(['Modernizr', 'prefixes', 'createElement'], function( Modernizr, prefixes, createElement ) {
//
// For CSS Gradients syntax, please see:
// webkit.org/blog/175/introducing-css-gradients/
// developer.mozilla.org/en/CSS/-moz-linear-gradient
// developer.mozilla.org/en/CSS/-moz-radial-gradient
// dev.w3.org/csswg/css3-images/#gradients-
//

Modernizr.addTest('cssgradients', function() {

Expand Down
12 changes: 9 additions & 3 deletions feature-detects/css/hsla.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
/*!
{
"name": "CSS HSLA Colors",
"caniuse": "",X
"property": "hsla",
"tags": ["css"],
"notes": ["Same as rgba(), in fact, browsers re-map hsla() to rgba() internally, except IE9 who retains it as hsla"]
}
!*/
define(['Modernizr', 'createElement', 'contains'], function( Modernizr, createElement, contains ) {
// Same as rgba(), in fact, browsers re-map hsla() to rgba() internally,
// except IE9 who retains it as hsla

Modernizr.addTest('hsla', function() {
var elem = createElement('div');
var style = elem.style;
Expand Down
51 changes: 34 additions & 17 deletions feature-detects/css/hyphens.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
/*!
{
"name": "CSS Hyphens",
"caniuse": "",X
"property": ["csshyphens", "softhyphens", "softhyphensfind"],
"tags": ["css"],
"authors": ["David Newton"],
"warnings": [
"These tests currently require document.body to be present",
"If loading Hyphenator.js via Modernizr.load, be cautious of issue 158: http://code.google.com/p/hyphenator/issues/detail?id=158"
],
"notes": [
"csshyphens - tests hyphens:auto actually adds hyphens to text",
"softhyphens - tests that ­ does its job",
"softhyphensfind - tests that in-browser Find functionality still works correctly with ­",
{
"name": "The Current State of Hyphenation on the Web.",
"href": "http://davidnewton.ca/the-current-state-of-hyphenation-on-the-web"
},
{
"name": "Hyphenation Test Page",
"href": "http://davidnewton.ca/demos/hyphenation/test.html"
},
{
"name": "Hyphenation is Language Specific",
"href": " http://code.google.com/p/hyphenator/source/diff?spec=svn975&r=975&format=side&path=/trunk/Hyphenator.js#sc_svn975_313"
},
{
"name": "Related Modernizr Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/312"
}
]
}
!*/
define(['Modernizr', 'prefixes', 'createElement', 'testAllProps', 'addTest'], function( Modernizr, prefixes, createElement, testAllProps, addTest ) {
/* see http://davidnewton.ca/the-current-state-of-hyphenation-on-the-web
http://davidnewton.ca/demos/hyphenation/test.html
There are three tests:
1. csshyphens - tests hyphens:auto actually adds hyphens to text
2. softhyphens - tests that ­ does its job
3. softhyphensfind - tests that in-browser Find functionality still works correctly with ­
These tests currently require document.body to be present
Hyphenation is language specific, sometimes.
See for more details: http://code.google.com/p/hyphenator/source/diff?spec=svn975&r=975&format=side&path=/trunk/Hyphenator.js#sc_svn975_313
If loading Hyphenator.js via Modernizr.load, be cautious of issue 158: http://code.google.com/p/hyphenator/issues/detail?id=158
More details at https://github.com/Modernizr/Modernizr/issues/312
*/

Modernizr.addAsyncTest(function() {
var waitTime = 300;
Expand Down

0 comments on commit c838184

Please sign in to comment.