-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial image based tests for doughnnut backgroundColor,
borderColor, and borderWidth.
- Loading branch information
Showing
18 changed files
with
389 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
test/fixtures/controller.doughnut/backgroundColor/indexable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
backgroundColor: [ | ||
'#ff0000', | ||
'#00ff00', | ||
'#0000ff', | ||
'#ffff00', | ||
'#ff00ff', | ||
'#000000' | ||
] | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: [ | ||
'#ff88ff', | ||
'#888888', | ||
'#ff8800', | ||
'#00ff88', | ||
'#8800ff', | ||
'#ffff88' | ||
] | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions
46
test/fixtures/controller.doughnut/backgroundColor/scriptable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
backgroundColor: function(ctx) { | ||
var value = ctx.dataset.data[ctx.dataIndex] || 0; | ||
return value > 8 ? '#ff0000' | ||
: value > 6 ? '#00ff00' | ||
: value > 2 ? '#0000ff' | ||
: '#ff00ff'; | ||
} | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: function(ctx) { | ||
var value = ctx.dataset.data[ctx.dataIndex] || 0; | ||
return value > 8 ? '#ff0000' | ||
: value > 6 ? '#00ff00' | ||
: value > 2 ? '#0000ff' | ||
: '#ff00ff'; | ||
} | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions
34
test/fixtures/controller.doughnut/backgroundColor/value.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
backgroundColor: '#ff0000' | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: '#00ff00' | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions
50
test/fixtures/controller.doughnut/borderColor/indexable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
borderColor: [ | ||
'#ff0000', | ||
'#00ff00', | ||
'#0000ff', | ||
'#ffff00', | ||
'#ff00ff', | ||
'#000000' | ||
] | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: 'transparent', | ||
borderColor: [ | ||
'#ff88ff', | ||
'#888888', | ||
'#ff8800', | ||
'#00ff88', | ||
'#8800ff', | ||
'#ffff88' | ||
], | ||
borderWidth: 8 | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions
48
test/fixtures/controller.doughnut/borderColor/scriptable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
borderColor: function(ctx) { | ||
var value = ctx.dataset.data[ctx.dataIndex] || 0; | ||
return value > 8 ? '#ff0000' | ||
: value > 6 ? '#00ff00' | ||
: value > 2 ? '#0000ff' | ||
: '#ff00ff'; | ||
} | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: 'transparent', | ||
borderColor: function(ctx) { | ||
var value = ctx.dataset.data[ctx.dataIndex] || 0; | ||
return value > 8 ? '#ff00ff' | ||
: value > 6 ? '#0000ff' | ||
: value > 2 ? '#ff0000' | ||
: '#00ff00'; | ||
}, | ||
borderWidth: 8 | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
borderColor: '#ff0000' | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: 'transparent', | ||
borderColor: '#00ff00', | ||
borderWidth: 8 | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions
50
test/fixtures/controller.doughnut/borderWidth/indexable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
borderWidth: [ | ||
0, | ||
1, | ||
2, | ||
3, | ||
4, | ||
5 | ||
] | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: 'transparent', | ||
borderColor: '#888', | ||
borderWidth: [ | ||
5, | ||
4, | ||
3, | ||
2, | ||
1, | ||
0 | ||
] | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
test/fixtures/controller.doughnut/borderWidth/scriptable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
borderWidth: function(ctx) { | ||
var value = ctx.dataset.data[ctx.dataIndex] || 0; | ||
return Math.abs(value); | ||
} | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: 'transparent', | ||
borderColor: '#888', | ||
borderWidth: function(ctx) { | ||
return ctx.dataIndex * 2; | ||
} | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
borderWidth: 2 | ||
}, | ||
{ | ||
// option in element (fallback) | ||
data: [0, 2, 4, null, 6, 8], | ||
} | ||
] | ||
}, | ||
options: { | ||
legend: false, | ||
title: false, | ||
elements: { | ||
arc: { | ||
backgroundColor: 'transparent', | ||
borderColor: '#888', | ||
borderWidth: 4 | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.