Skip to content

Commit 3737ca9

Browse files
committed
add jasmine tests for sunburst and treemap transition with uniformtext
1 parent c630060 commit 3737ca9

File tree

2 files changed

+128
-0
lines changed

2 files changed

+128
-0
lines changed

test/jasmine/tests/sunburst_test.js

+64
Original file line numberDiff line numberDiff line change
@@ -2099,4 +2099,68 @@ describe('sunburst uniformtext', function() {
20992099
.catch(failTest)
21002100
.then(done);
21012101
});
2102+
2103+
it('should uniform text scales after transition', function(done) {
2104+
Plotly.plot(gd, {
2105+
data: [{
2106+
type: 'sunburst',
2107+
parents: [
2108+
'',
2109+
'Oscar',
2110+
'Oscar',
2111+
'Oscar',
2112+
'Oscar',
2113+
'Oscar',
2114+
'Oscar',
2115+
'Uniform',
2116+
'Uniform',
2117+
'Uniform',
2118+
'Uniform',
2119+
'Uniform',
2120+
'Uniform'
2121+
],
2122+
labels: [
2123+
'Oscar',
2124+
'Papa',
2125+
'Quebec',
2126+
'Romeo',
2127+
'Sierra',
2128+
'Tango',
2129+
'Uniform',
2130+
'Victor',
2131+
'Whiskey',
2132+
'X ray',
2133+
'Yankee',
2134+
'Zulu'
2135+
],
2136+
textinfo: 'label'
2137+
}],
2138+
layout: {
2139+
width: 350,
2140+
height: 350,
2141+
uniformtext: {
2142+
mode: 'hide',
2143+
minsize: 10
2144+
}
2145+
}
2146+
})
2147+
.then(assertTextSizes('before click', {
2148+
fontsizes: [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12],
2149+
scales: [0.92, 0.92, 0.92, 0, 0, 0, 0, 0.92, 0.92, 0.92, 0.92, 0.92],
2150+
}))
2151+
.then(click(gd, 2)) // click on Uniform
2152+
.then(delay(constants.CLICK_TRANSITION_TIME + 1))
2153+
.then(assertTextSizes('after click child', {
2154+
fontsizes: [12, 12, 12, 12, 12, 12],
2155+
scales: [1, 1, 1, 1, 1, 1],
2156+
}))
2157+
.then(click(gd, 1)) // click on Oscar
2158+
.then(delay(constants.CLICK_TRANSITION_TIME + 1))
2159+
.then(assertTextSizes('after click parent', {
2160+
fontsizes: [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12],
2161+
scales: [0.92, 0.92, 0.92, 0, 0, 0, 0, 0.92, 0.92, 0.92, 0.92, 0.92],
2162+
}))
2163+
.catch(failTest)
2164+
.then(done);
2165+
});
21022166
});

test/jasmine/tests/treemap_test.js

+64
Original file line numberDiff line numberDiff line change
@@ -1807,4 +1807,68 @@ describe('treemap uniformtext', function() {
18071807
.catch(failTest)
18081808
.then(done);
18091809
});
1810+
1811+
it('should uniform text scales after transition', function(done) {
1812+
Plotly.plot(gd, {
1813+
data: [{
1814+
type: 'treemap',
1815+
parents: [
1816+
'',
1817+
'Oscar',
1818+
'Oscar',
1819+
'Oscar',
1820+
'Oscar',
1821+
'Oscar',
1822+
'Oscar',
1823+
'Uniform',
1824+
'Uniform',
1825+
'Uniform',
1826+
'Uniform',
1827+
'Uniform',
1828+
'Uniform'
1829+
],
1830+
labels: [
1831+
'Oscar',
1832+
'Papa',
1833+
'Quebec',
1834+
'Romeo',
1835+
'Sierra',
1836+
'Tango',
1837+
'Uniform',
1838+
'Victor',
1839+
'Whiskey',
1840+
'X ray',
1841+
'Yankee',
1842+
'Zulu'
1843+
],
1844+
textinfo: 'label'
1845+
}],
1846+
layout: {
1847+
width: 350,
1848+
height: 350,
1849+
uniformtext: {
1850+
mode: 'hide',
1851+
minsize: 10
1852+
}
1853+
}
1854+
})
1855+
.then(assertTextSizes('before click', {
1856+
fontsizes: [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12],
1857+
scales: [0.84, 0.84, 0.84, 0, 0.84, 0.84, 0, 0.84, 0, 0.84, 0.84, 0],
1858+
}))
1859+
.then(click(gd, 2)) // click on Uniform
1860+
.then(delay(constants.CLICK_TRANSITION_TIME + 1))
1861+
.then(assertTextSizes('after click child', {
1862+
fontsizes: [12, 12, 12, 12, 12, 12, 12],
1863+
scales: [0.86, 0.86, 0.86, 0.86, 0.86, 0.86, 0.86],
1864+
}))
1865+
.then(click(gd, 1)) // click on Oscar
1866+
.then(delay(constants.CLICK_TRANSITION_TIME + 1))
1867+
.then(assertTextSizes('after click parent', {
1868+
fontsizes: [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12],
1869+
scales: [0.84, 0.84, 0.84, 0, 0.84, 0.84, 0, 0.84, 0, 0.84, 0.84, 0],
1870+
}))
1871+
.catch(failTest)
1872+
.then(done);
1873+
});
18101874
});

0 commit comments

Comments
 (0)