mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Add test for adding class prior to rendering (#508)
This commit is contained in:
parent
77c73c478f
commit
db88784655
@ -7,11 +7,21 @@
|
|||||||
<script src="../assets/jquery-1.6.2.js"></script>
|
<script src="../assets/jquery-1.6.2.js"></script>
|
||||||
<script src="lib/expect.js"></script>
|
<script src="lib/expect.js"></script>
|
||||||
<script src="lib/mocha.js"></script>
|
<script src="lib/mocha.js"></script>
|
||||||
|
<style>
|
||||||
|
#block2 {
|
||||||
|
background: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-css-class #block2 {
|
||||||
|
background: green;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="mocha"></div>
|
<div id="mocha"></div>
|
||||||
<script>mocha.setup('bdd')</script>
|
<script>mocha.setup('bdd')</script>
|
||||||
<div style="background: red; width: 200px; height:200px;" id="block"></div>
|
<div style="background: red; width: 200px; height:200px;" id="block"></div>
|
||||||
|
<div style="width: 200px; height:200px;" id="block2"></div>
|
||||||
<script>
|
<script>
|
||||||
describe("options.onclone", function() {
|
describe("options.onclone", function() {
|
||||||
it("with a function", function(done) {
|
it("with a function", function(done) {
|
||||||
@ -46,6 +56,19 @@
|
|||||||
done(error);
|
done(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("add class to node", function(done) {
|
||||||
|
html2canvas(document.querySelector("#block2"), {onclone: function(document) {
|
||||||
|
document.documentElement.className = "my-css-class";
|
||||||
|
}}).then(function(canvas) {
|
||||||
|
expect(canvas.width).to.equal(200);
|
||||||
|
expect(canvas.height).to.equal(200);
|
||||||
|
validCanvasPixels(canvas);
|
||||||
|
done();
|
||||||
|
}).catch(function(error) {
|
||||||
|
done(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function validCanvasPixels(canvas) {
|
function validCanvasPixels(canvas) {
|
||||||
|
Loading…
Reference in New Issue
Block a user