Skip to content

Commit 74e95c3

Browse files
committed
chore: remove now unused code
1 parent eb89b8f commit 74e95c3

File tree

3 files changed

+1
-303
lines changed

3 files changed

+1
-303
lines changed

app/components/Chart/PatternSlot.vue

Lines changed: 0 additions & 32 deletions
This file was deleted.

test/nuxt/a11y.spec.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ import {
144144
LandingLogo,
145145
LinkBase,
146146
CallToAction,
147-
ChartPatternSlot,
148147
CodeDirectoryListing,
149148
CodeFileTree,
150149
CodeMobileTreeDrawer,
@@ -2261,23 +2260,6 @@ describe('component accessibility audits', () => {
22612260
})
22622261
})
22632262

2264-
describe('ChartPatternSlot', () => {
2265-
it('should have no accessibility violations', async () => {
2266-
const component = await mountSuspended(ChartPatternSlot, {
2267-
props: {
2268-
id: 'perennius',
2269-
seed: 1,
2270-
foregroundColor: 'black',
2271-
fallbackColor: 'transparent',
2272-
maxSize: 24,
2273-
minSize: 16,
2274-
},
2275-
})
2276-
const results = await runAxe(component)
2277-
expect(results.violations).toEqual([])
2278-
})
2279-
})
2280-
22812263
describe('CopyToClipboardButton', () => {
22822264
it('should have no accessibility violations in default state', async () => {
22832265
const component = await mountSuspended(CopyToClipboardButton, {

test/unit/app/utils/charts.spec.ts

Lines changed: 1 addition & 253 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import {
1515
sanitise,
1616
insertLineBreaks,
1717
applyEllipsis,
18-
createSeedNumber,
19-
createSeededSvgPattern,
20-
createChartPatternSlotMarkup,
2118
type TrendLineConfig,
2219
type TrendLineDataset,
2320
type VersionsBarConfig,
@@ -1401,253 +1398,4 @@ describe('applyEllipsis', () => {
14011398
it('preserves whitespace within the truncated portion', () => {
14021399
expect(applyEllipsis('you need to touch grass', 13)).toBe('you need to t...')
14031400
})
1404-
})
1405-
1406-
describe('createSeedNumber', () => {
1407-
it('returns the same hash for the same input', () => {
1408-
expect(createSeedNumber('react')).toBe(createSeedNumber('react'))
1409-
expect(createSeedNumber('vue')).toBe(createSeedNumber('vue'))
1410-
})
1411-
1412-
it('returns different hashes for different inputs', () => {
1413-
expect(createSeedNumber('react')).not.toBe(createSeedNumber('vue'))
1414-
expect(createSeedNumber('svelte')).not.toBe(createSeedNumber('solid'))
1415-
})
1416-
1417-
it('returns a 32 bit unsigned integer', () => {
1418-
const result = createSeedNumber('react')
1419-
expect(Number.isInteger(result)).toBe(true)
1420-
expect(result).toBeGreaterThanOrEqual(0)
1421-
expect(result).toBeLessThanOrEqual(4294967295)
1422-
})
1423-
1424-
it('handles an empty string', () => {
1425-
const result = createSeedNumber('')
1426-
expect(Number.isInteger(result)).toBe(true)
1427-
expect(result).toBeGreaterThanOrEqual(0)
1428-
expect(result).toBeLessThanOrEqual(4294967295)
1429-
})
1430-
1431-
it('is case sensitive', () => {
1432-
expect(createSeedNumber('react')).not.toBe(createSeedNumber('React'))
1433-
})
1434-
})
1435-
1436-
describe('createSeededSvgPattern', () => {
1437-
it('returns deterministic output for the same seed', () => {
1438-
const first = createSeededSvgPattern('react')
1439-
const second = createSeededSvgPattern('react')
1440-
expect(first).toEqual(second)
1441-
})
1442-
1443-
it('returns different output for different seeds', () => {
1444-
const first = createSeededSvgPattern('react')
1445-
const second = createSeededSvgPattern('vue')
1446-
expect(second).not.toEqual(first)
1447-
})
1448-
1449-
it('returns a valid pattern object shape', () => {
1450-
const result = createSeededSvgPattern('react')
1451-
expect(typeof result.width).toBe('number')
1452-
expect(typeof result.height).toBe('number')
1453-
expect(typeof result.rotation).toBe('number')
1454-
expect(typeof result.patternType).toBe('string')
1455-
expect(typeof result.contentMarkup).toBe('string')
1456-
})
1457-
1458-
it('uses default options when none are provided', () => {
1459-
const result = createSeededSvgPattern('react')
1460-
expect(result.width).toBeGreaterThanOrEqual(8)
1461-
expect(result.width).toBeLessThanOrEqual(20)
1462-
expect(result.height).toBe(result.width)
1463-
expect(result.contentMarkup.length).toBeGreaterThan(0)
1464-
})
1465-
1466-
it('uses the provided foreground and background colors', () => {
1467-
const result = createSeededSvgPattern('react', {
1468-
foregroundColor: '#ff0000',
1469-
backgroundColor: '#00ff00',
1470-
})
1471-
expect(result.contentMarkup).toContain('#ff0000')
1472-
expect(result.contentMarkup).toContain('#00ff00')
1473-
expect(result.contentMarkup).toContain('<rect x="0" y="0"')
1474-
})
1475-
1476-
it('does not inject a background rect when backgroundColor is transparent', () => {
1477-
const result = createSeededSvgPattern('react', {
1478-
backgroundColor: 'transparent',
1479-
})
1480-
expect(result.contentMarkup).not.toContain('<rect x="0" y="0"')
1481-
})
1482-
1483-
it('respects the provided size range', () => {
1484-
const result = createSeededSvgPattern('react', {
1485-
minimumSize: 10,
1486-
maximumSize: 16,
1487-
})
1488-
expect(result.width).toBeGreaterThanOrEqual(10)
1489-
expect(result.width).toBeLessThanOrEqual(16)
1490-
expect(result.height).toBe(result.width)
1491-
})
1492-
1493-
it('always returns one of the supported pattern types', () => {
1494-
const allowedPatternTypes = [
1495-
'diagonalLines',
1496-
'verticalLines',
1497-
'horizontalLines',
1498-
'crosshatch',
1499-
'dots',
1500-
'grid',
1501-
'zigzag',
1502-
]
1503-
const result = createSeededSvgPattern('react')
1504-
expect(allowedPatternTypes).toContain(result.patternType)
1505-
})
1506-
1507-
it('returns a supported rotation value', () => {
1508-
const allowedRotations = [0, 15, 30, 45, 60, 75, 90, 120, 135]
1509-
const result = createSeededSvgPattern('react')
1510-
expect(allowedRotations).toContain(result.rotation)
1511-
})
1512-
1513-
it('returns svg markup matching the selected pattern type', () => {
1514-
const seeds = [
1515-
'react',
1516-
'vue',
1517-
'svelte',
1518-
'solid',
1519-
'angular',
1520-
'ember',
1521-
'preact',
1522-
'lit',
1523-
'alpine',
1524-
'nuxt',
1525-
'next',
1526-
'astro',
1527-
'qwik',
1528-
'backbone',
1529-
]
1530-
1531-
const expectedTagByPatternType: Record<
1532-
ReturnType<typeof createSeededSvgPattern>['patternType'],
1533-
string
1534-
> = {
1535-
diagonalLines: '<line',
1536-
verticalLines: '<line',
1537-
horizontalLines: '<line',
1538-
crosshatch: '<line',
1539-
dots: '<circle',
1540-
grid: '<line',
1541-
zigzag: '<path',
1542-
}
1543-
1544-
for (const seed of seeds) {
1545-
const result = createSeededSvgPattern(seed)
1546-
const expectedTag = expectedTagByPatternType[result.patternType]
1547-
expect(result.contentMarkup).toContain(expectedTag)
1548-
}
1549-
})
1550-
1551-
it('accepts numeric seeds', () => {
1552-
const result = createSeededSvgPattern(12345)
1553-
expect(typeof result.width).toBe('number')
1554-
expect(typeof result.contentMarkup).toBe('string')
1555-
expect(result.contentMarkup.length).toBeGreaterThan(0)
1556-
})
1557-
1558-
it('returns deterministic output for equivalent numeric and string seeds', () => {
1559-
const numericSeedResult = createSeededSvgPattern(12345)
1560-
const stringSeedResult = createSeededSvgPattern('12345')
1561-
expect(numericSeedResult).toEqual(stringSeedResult)
1562-
})
1563-
})
1564-
1565-
describe('createChartPatternSlotMarkup', () => {
1566-
it('returns a pattern element with the provided id', () => {
1567-
const result = createChartPatternSlotMarkup({
1568-
id: 'pattern-1',
1569-
seed: 7,
1570-
color: '#ff0000',
1571-
foregroundColor: '#ffffff',
1572-
fallbackColor: 'transparent',
1573-
maxSize: 24,
1574-
minSize: 16,
1575-
})
1576-
1577-
expect(result).toContain('<pattern')
1578-
expect(result).toContain('id="pattern-1"')
1579-
expect(result).toContain('patternUnits="userSpaceOnUse"')
1580-
expect(result).toContain('</pattern>')
1581-
})
1582-
1583-
it('includes width, height, rotation, and content markup from the generated pattern', () => {
1584-
const generatedPattern = createSeededSvgPattern(1, {
1585-
foregroundColor: '#000',
1586-
backgroundColor: 'transparent',
1587-
minimumSize: 16,
1588-
maximumSize: 24,
1589-
})
1590-
1591-
const result = createChartPatternSlotMarkup({
1592-
id: 'pattern-1',
1593-
seed: 1,
1594-
foregroundColor: '#000',
1595-
fallbackColor: 'transparent',
1596-
maxSize: 24,
1597-
minSize: 16,
1598-
})
1599-
1600-
expect(result).toContain(`width="${generatedPattern.width}"`)
1601-
expect(result).toContain(`height="${generatedPattern.height}"`)
1602-
expect(result).toContain(`patternTransform="rotate(${generatedPattern.rotation})"`)
1603-
expect(result).toContain(generatedPattern.contentMarkup)
1604-
})
1605-
1606-
it('is deterministic for the same inputs', () => {
1607-
const first = createChartPatternSlotMarkup({
1608-
id: 'pattern-stable',
1609-
seed: 'nuxt',
1610-
color: '#00ff00',
1611-
foregroundColor: '#000000',
1612-
fallbackColor: 'transparent',
1613-
maxSize: 40,
1614-
minSize: 10,
1615-
})
1616-
1617-
const second = createChartPatternSlotMarkup({
1618-
id: 'pattern-stable',
1619-
seed: 'nuxt',
1620-
color: '#00ff00',
1621-
foregroundColor: '#000000',
1622-
fallbackColor: 'transparent',
1623-
maxSize: 40,
1624-
minSize: 10,
1625-
})
1626-
1627-
expect(first).toBe(second)
1628-
})
1629-
1630-
it('changes when the id changes', () => {
1631-
const first = createChartPatternSlotMarkup({
1632-
id: 'pattern-a',
1633-
seed: 1,
1634-
color: '#00ff00',
1635-
foregroundColor: '#000000',
1636-
fallbackColor: 'transparent',
1637-
maxSize: 40,
1638-
minSize: 10,
1639-
})
1640-
1641-
const second = createChartPatternSlotMarkup({
1642-
id: 'pattern-b',
1643-
seed: 2,
1644-
color: '#00ff00',
1645-
foregroundColor: '#000000',
1646-
fallbackColor: 'transparent',
1647-
maxSize: 40,
1648-
minSize: 10,
1649-
})
1650-
1651-
expect(first).not.toBe(second)
1652-
})
1653-
})
1401+
})

0 commit comments

Comments
 (0)