2017-08-08 19:50:31 +03:00
|
|
|
describe('Gradients', function() {
|
2014-10-15 21:28:26 +04:00
|
|
|
var expected = [
|
2012-03-06 01:04:25 +04:00
|
|
|
{
|
2017-08-08 19:50:31 +03:00
|
|
|
method: 'linear-gradient',
|
|
|
|
args: ['left', ' rgb(255, 0, 0)', ' rgb(255, 255, 0)', ' rgb(0, 255, 0)']
|
2012-03-06 01:04:25 +04:00
|
|
|
},
|
2015-01-20 19:29:42 +03:00
|
|
|
{
|
2017-08-08 19:50:31 +03:00
|
|
|
method: 'linear-gradient',
|
|
|
|
args: ['left', ' red', ' rgb(255, 255, 0)', ' rgb(0, 255, 0)']
|
2015-01-20 19:29:42 +03:00
|
|
|
},
|
2012-03-06 01:04:25 +04:00
|
|
|
{
|
2014-02-15 02:30:28 +04:00
|
|
|
method: 'linear-gradient',
|
|
|
|
args: [
|
2017-08-08 19:50:31 +03:00
|
|
|
'left',
|
|
|
|
' rgb(206, 219, 233) 0%',
|
|
|
|
' rgb(170, 197, 222) 17%',
|
|
|
|
' rgb(97, 153, 199) 50%',
|
|
|
|
' rgb(58, 132, 195) 51%',
|
|
|
|
' rgb(65, 154, 214) 59%',
|
|
|
|
' rgb(75, 184, 240) 71%',
|
|
|
|
' rgb(58, 139, 194) 84%',
|
|
|
|
' rgb(38, 85, 139) 100%'
|
2012-03-06 01:04:25 +04:00
|
|
|
]
|
2012-03-06 03:03:36 +04:00
|
|
|
},
|
2015-01-20 19:29:42 +03:00
|
|
|
{
|
|
|
|
method: 'linear-gradient',
|
|
|
|
args: [
|
2017-08-08 19:50:31 +03:00
|
|
|
'left',
|
|
|
|
' rgb(206, 219, 233) 0%',
|
|
|
|
' rgb(170, 197, 222) 17px',
|
|
|
|
' rgb(97, 153, 199) 50%',
|
|
|
|
' rgb(58, 132, 195) 51px',
|
|
|
|
' rgb(65, 154, 214) 59%',
|
|
|
|
' rgb(75, 184, 240) 71px',
|
|
|
|
' rgb(58, 139, 194) 84%',
|
|
|
|
' rgb(38, 85, 139) 100px'
|
2015-01-20 19:29:42 +03:00
|
|
|
]
|
|
|
|
},
|
2012-03-06 03:03:36 +04:00
|
|
|
{
|
2017-08-08 19:50:31 +03:00
|
|
|
method: 'gradient',
|
2014-02-15 02:30:28 +04:00
|
|
|
args: [
|
2017-08-08 19:50:31 +03:00
|
|
|
'linear',
|
|
|
|
' 50% 0%',
|
|
|
|
' 50% 100%',
|
|
|
|
' from(rgb(240, 183, 161))',
|
|
|
|
' color-stop(0.5, rgb(140, 51, 16))',
|
|
|
|
' color-stop(0.51, rgb(117, 34, 1))',
|
|
|
|
' to(rgb(191, 110, 78))'
|
2012-03-06 03:03:36 +04:00
|
|
|
]
|
2012-03-10 02:37:45 +04:00
|
|
|
},
|
2015-01-20 19:29:42 +03:00
|
|
|
{
|
2017-08-08 19:50:31 +03:00
|
|
|
method: 'gradient',
|
2015-01-20 19:29:42 +03:00
|
|
|
args: [
|
2017-08-08 19:50:31 +03:00
|
|
|
'linear',
|
|
|
|
' 50% 0%',
|
|
|
|
' 50% 100%',
|
|
|
|
' from(rgb(255, 0, 0))',
|
|
|
|
' color-stop(0.314159, green)',
|
|
|
|
' color-stop(0.51, rgb(0, 0, 255))',
|
2015-01-20 19:29:42 +03:00
|
|
|
// temporary workaround for Blink/WebKit bug: crbug.com/453414
|
|
|
|
//" to(rgba(0, 0, 0, 0.5))"
|
2017-08-08 19:50:31 +03:00
|
|
|
' to(rgba(0, 0, 0, 0))'
|
2015-01-20 19:29:42 +03:00
|
|
|
]
|
|
|
|
},
|
2015-10-18 16:51:53 +03:00
|
|
|
{
|
|
|
|
method: 'linear-gradient',
|
2017-08-08 19:50:31 +03:00
|
|
|
args: ['0deg', ' rgb(221, 221, 221)', ' rgb(221, 221, 221) 50%', ' transparent 50%']
|
2015-10-18 16:51:53 +03:00
|
|
|
},
|
2012-03-10 02:37:45 +04:00
|
|
|
{
|
2017-08-08 19:50:31 +03:00
|
|
|
method: 'radial-gradient',
|
2014-02-15 02:30:28 +04:00
|
|
|
args: [
|
2017-08-08 19:50:31 +03:00
|
|
|
'75% 19%',
|
|
|
|
' ellipse closest-side',
|
|
|
|
' rgb(171, 171, 171)',
|
|
|
|
' rgb(0, 0, 255) 33%',
|
|
|
|
' rgb(153, 31, 31) 100%'
|
2012-03-10 02:37:45 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2017-08-08 19:50:31 +03:00
|
|
|
method: 'radial-gradient',
|
2014-02-15 02:30:28 +04:00
|
|
|
args: [
|
2017-08-08 19:50:31 +03:00
|
|
|
'75% 19%',
|
|
|
|
' ellipse closest-corner',
|
|
|
|
' rgb(171, 171, 171)',
|
|
|
|
' rgb(0, 0, 255) 33%',
|
|
|
|
' rgb(153, 31, 31) 100%'
|
2012-03-10 02:37:45 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2017-08-08 19:50:31 +03:00
|
|
|
method: 'radial-gradient',
|
2014-02-15 02:30:28 +04:00
|
|
|
args: [
|
2017-08-08 19:50:31 +03:00
|
|
|
'75% 19%',
|
|
|
|
' ellipse farthest-side',
|
|
|
|
' rgb(171, 171, 171)',
|
|
|
|
' rgb(0, 0, 255) 33%',
|
|
|
|
' rgb(153, 31, 31) 100%'
|
2012-03-10 02:37:45 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2017-08-08 19:50:31 +03:00
|
|
|
method: 'radial-gradient',
|
2014-02-15 02:30:28 +04:00
|
|
|
args: [
|
2017-08-08 19:50:31 +03:00
|
|
|
'75% 19%',
|
|
|
|
' ellipse farthest-corner',
|
|
|
|
' rgb(171, 171, 171)',
|
|
|
|
' rgb(0, 0, 255) 33%',
|
|
|
|
' rgb(153, 31, 31) 100%'
|
2012-03-10 02:37:45 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2017-08-08 19:50:31 +03:00
|
|
|
method: 'radial-gradient',
|
2014-02-15 02:30:28 +04:00
|
|
|
args: [
|
2017-08-08 19:50:31 +03:00
|
|
|
'75% 19%',
|
|
|
|
' ellipse contain',
|
|
|
|
' rgb(171, 171, 171)',
|
|
|
|
' rgb(0, 0, 255) 33%',
|
|
|
|
' rgb(153, 31, 31) 100%'
|
2012-03-10 02:37:45 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2017-08-08 19:50:31 +03:00
|
|
|
method: 'radial-gradient',
|
2014-02-15 02:30:28 +04:00
|
|
|
args: [
|
2017-08-08 19:50:31 +03:00
|
|
|
'75% 19%',
|
|
|
|
' ellipse cover',
|
|
|
|
' rgb(171, 171, 171)',
|
|
|
|
' rgb(0, 0, 255) 33%',
|
|
|
|
' rgb(153, 31, 31) 100%'
|
2012-03-10 02:37:45 +04:00
|
|
|
]
|
2012-03-06 01:04:25 +04:00
|
|
|
}
|
|
|
|
];
|
2012-03-04 23:06:25 +04:00
|
|
|
|
2017-08-08 19:50:31 +03:00
|
|
|
[].slice
|
|
|
|
.call(document.querySelectorAll('#backgroundGradients div'), 0)
|
|
|
|
.forEach(function(node, i) {
|
|
|
|
var container = new html2canvas.NodeContainer(node, null);
|
|
|
|
var value = container.css('backgroundImage');
|
|
|
|
it(value, function() {
|
|
|
|
var parsedBackground = html2canvas.utils.parseBackgrounds(value);
|
|
|
|
if (parsedBackground[0].args[0] === '0% 50%') {
|
|
|
|
parsedBackground[0].args[0] = 'left';
|
|
|
|
}
|
|
|
|
expect(parsedBackground[0].args).to.eql(expected[i].args);
|
|
|
|
expect(parsedBackground[0].method).to.eql(expected[i].method);
|
|
|
|
});
|
2012-03-04 23:06:25 +04:00
|
|
|
});
|
2014-02-15 02:30:28 +04:00
|
|
|
});
|