Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 737786 - 4/5 - Add more tests for ::-moz-placeholder. r=bz
Browse files Browse the repository at this point in the history
  • Loading branch information
mounirlamouri committed Nov 9, 2012
1 parent 131fb24 commit 7c8431b
Show file tree
Hide file tree
Showing 18 changed files with 221 additions and 0 deletions.
9 changes: 9 additions & 0 deletions layout/reftests/css-placeholder/css-background-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<body>
<input placeholder='foo'>
<textarea placeholder='foo'></textarea>
<input placeholder='foo'>
<textarea placeholder='foo'></textarea>
</body>
</html>
23 changes: 23 additions & 0 deletions layout/reftests/css-placeholder/css-background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<!--
This test checks that setting a background on a ::-moz-placeholder works.
However, given that it is not possible to do an actualy equality check, we
have te check that setting a background doesn't produce the same result
as not setting it.
-->
<style>
:-moz-any(input, textarea).color::-moz-placeholder {
background-color: blue;
}
:-moz-any(input, textarea).gradient::-moz-placeholder {
background: linear-gradient(to right, blue, white, red);
}
</style>
<body>
<input class="color" placeholder='foo'>
<textarea class="color" placeholder='foo'></textarea>
<input class="gradient" placeholder='foo'>
<textarea class="gradient" placeholder='foo'></textarea>
</body>
</html>
9 changes: 9 additions & 0 deletions layout/reftests/css-placeholder/css-restrictions-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<body>
<input placeholder='foo'>
<textarea placeholder='foo'></textarea>
<input placeholder='this is a quitelongetextforasmallelement'>
<textarea placeholder='this is a quitelongetextforasmallelement'></textarea>
</body>
</html>
24 changes: 24 additions & 0 deletions layout/reftests/css-placeholder/css-restrictions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<style>
:-moz-any(input, textarea)::-moz-placeholder {
visibility: hidden;
padding: 20px;
float: right;
overflow: visible;
white-space: pre;

/*
* This list could be endless given that all non-whitelisted properties
* are restricted.
*/
}
</style>
<body>
<input placeholder='foo'>
<textarea placeholder='foo'></textarea>
<!-- for overflow and white-space -->
<input placeholder='this is a quitelongetextforasmallelement'>
<textarea placeholder='this is a quitelongetextforasmallelement'></textarea>
</body>
</html>
17 changes: 17 additions & 0 deletions layout/reftests/css-placeholder/css-simple-styling-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<style>
:-moz-any(input, textarea) {
font: -moz-list;
font-family: mono;
font-style: italic;
color: blue;
word-spacing: 5px;
text-shadow: 1px 1px 1px red;
}
</style>
<body>
<input value='foo bar'>
<textarea>foo bar</textarea>
</body>
</html>
31 changes: 31 additions & 0 deletions layout/reftests/css-placeholder/css-simple-styling.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<!--
This test checks that a few allowed CSS properties have an effect when
applied to ::-moz-placeholder.
-->
<style>
/*
* We need to set some properties on the <input> because its size will
* depend on its font.
*/
input, textarea {
font: -moz-list;
font-family: mono;
font-style: italic;
}

:-moz-any(input, textarea)::-moz-placeholder {
font: -moz-list;
font-family: mono;
font-style: italic;
color: blue;
word-spacing: 5px;
text-shadow: 1px 1px 1px red;
}
</style>
<body>
<input placeholder='foo bar'>
<textarea placeholder='foo bar'></textarea>
</body>
</html>
12 changes: 12 additions & 0 deletions layout/reftests/css-placeholder/input/css-display.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
input::-moz-placeholder {
display: inline;
}
</style>
<body>
<input placeholder='foo'>
</body>
</html>
12 changes: 12 additions & 0 deletions layout/reftests/css-placeholder/input/css-opacity.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
input::-moz-placeholder {
opacity: 0.1;
}
</style>
<body>
<input placeholder='foo'>
</body>
</html>
4 changes: 4 additions & 0 deletions layout/reftests/css-placeholder/input/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ needs-focus == placeholder-blur.html placeholder-simple-ref.html
== placeholder-value-reset.html placeholder-simple-ref.html
== placeholder-type-change-1.html placeholder-simple-ref.html
== placeholder-type-change-2.html placeholder-button-ref.html
== css-display.html placeholder-simple-ref.html
# We can't check except by verifying that the output is different.
# Same reasons as focus issues explained above.
!= css-opacity.html placeholder-simple-ref.html
4 changes: 4 additions & 0 deletions layout/reftests/css-placeholder/reftest.list
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
include input/reftest.list
include textarea/reftest.list

== css-restrictions.html css-restrictions-ref.html
== css-simple-styling.html css-simple-styling-ref.html
!= css-background.html css-background-ref.html
12 changes: 12 additions & 0 deletions layout/reftests/css-placeholder/textarea/css-display.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
textarea::-moz-placeholder {
display: inline;
}
</style>
<body>
<textarea placeholder='foo'></textarea>
</body>
</html>
12 changes: 12 additions & 0 deletions layout/reftests/css-placeholder/textarea/css-opacity.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
textarea::-moz-placeholder {
opacity: 0.1;
}
</style>
<body>
<textarea placeholder='foo'></textarea>
</body>
</html>
12 changes: 12 additions & 0 deletions layout/reftests/css-placeholder/textarea/css-resize-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
textarea {
resize: none;
}
</style>
<body>
<textarea class='ref'>foo</textarea>
</body>
</html>
18 changes: 18 additions & 0 deletions layout/reftests/css-placeholder/textarea/css-resize.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<!--
resize shouldn't be allowed on the ::-moz-placeholder.
-->
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
textarea {
resize: none;
}
textarea::-moz-placeholder {
resize: both;
}
</style>
<body>
<textarea placeholder='foo'></textarea>
</body>
</html>
5 changes: 5 additions & 0 deletions layout/reftests/css-placeholder/textarea/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ needs-focus == placeholder-blur.html placeholder-simple-ref.html
== placeholder-value-set.html placeholder-value-ref.html
== placeholder-value-unset.html placeholder-simple-ref.html
== placeholder-value-reset.html placeholder-simple-ref.html
== css-resize.html css-resize-ref.html
== css-display.html placeholder-simple-ref.html
# We can't check except by verifying that the output is different.
# Same reasons as focus issues explained above.
!= css-opacity.html placeholder-simple-ref.html
9 changes: 9 additions & 0 deletions layout/reftests/forms/placeholder/placeholder-rtl-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html dir='rtl'>
<link rel='stylesheet' type='text/css' href='placeholder-style.css'>
<body>
<input class='placeholder' value='foo'>
<textarea class='placeholder' >foo</textarea>
</body>
</html>

7 changes: 7 additions & 0 deletions layout/reftests/forms/placeholder/placeholder-rtl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!DOCTYPE html>
<html dir='rtl'>
<body>
<input placeholder='foo'>
<textarea placeholder='foo'></textarea>
</body>
</html>
1 change: 1 addition & 0 deletions layout/reftests/forms/placeholder/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ random-if(winWidget) == placeholder-19.xul placeholder-overridden-ref.xul
# needs-focus == placeholder-20.html placeholder-focus-ref.html
needs-focus == placeholder-21.html placeholder-blank-ref.html
needs-focus == placeholder-22.html placeholder-blank-ref.html
== placeholder-rtl.html placeholder-rtl-ref.html

0 comments on commit 7c8431b

Please sign in to comment.