Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding cssbackground test. #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/cssbackground/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
r: 0
spec: "http://www.w3.org/TR/css3-background/"
sources: ["https://github.com/Modernizr/Modernizr"]
title: "CSS3 Background"
52 changes: 52 additions & 0 deletions tests/cssbackground/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
test("CSS background shorthand property supports multiple images", function() {

var elem = document.createElement("div");

// Setting multiple images AND a color on the background shorthand property
// and then querying the style.background property value for the number of
// occurrences of "url(" is a reliable method for detecting ACTUAL support for this!

elem.style.cssText = "background:url(https://),url(https://),red url(https://)";

// If the UA supports multiple backgrounds, there should be three occurrences
// of the string "url(" in the return value for elem.style.background

assert( /(url\s*\(.*?){3}/.test( elem.style.background ), "background shorthand, multiple images supported" );

});

test("CSS background-image, background-position, background-repeat support multiple images", function() {

var elem = document.createElement("div"),

rule = "background-image:url(https://),url(https://);" +
"background-color: #000;" +
"background-position:left top, right top;" +
"background-repeat:repeat-x, no-repeat;";

elem.style.cssText = rule;

// If the UA supports multiple backgrounds, there should be two occurrences
// of the string "url(" in the return value for elem.style.background

assert( /(url\s*\(.*?){2}/.test( elem.style.background ), "CSS background-image, background-position, background-repeat support multiple images supported" );

});


test("CSS box-shadow", function() {
// According to the Modernizr source
// This test false-positives in WebOS
var elem = document.createElement("div");

assert( H.test.cssProp( elem, "boxShadow", true ), "CSS box-shadow supported" );

});

test("CSS border-radius", function() {

var elem = document.createElement("div");

assert( H.test.cssProp( elem, "borderRadius", true ), "CSS border-radius supported" );

});