import React from 'react'; import { Icon } from '@iconify-icon/react'; import { Tests, toggleTest } from './Tests'; export function TestIcon() { return (

Tests (offline module)

References

Getting reference { const key = 'offline-ref1'; if (element?.tagName.toLowerCase() === 'iconify-icon') { toggleTest(key, 'success'); } else { toggleTest(key, 'failed'); } }} />

Style

Inline style for icon { const key = 'offline-style'; if (element) { let errors = false; // Get style const style = element.style; switch (style.color.toLowerCase()) { case 'rgb(23, 105, 170)': case '#1769aa': break; default: console.log('Invalid color:', style.color); errors = true; } if (style.fontSize !== '24px') { console.log( 'Invalid font-size:', style.fontSize ); errors = true; } if (style.verticalAlign !== '-0.25em') { console.log( 'Invalid vertical-align:', style.verticalAlign ); errors = true; } toggleTest(key, errors ? 'failed' : 'success'); } else { toggleTest(key, 'failed'); } }} />
Green color from style:{' '} { const key = 'offline-color2'; if (element) { let errors = false; // Get style const style = element.style; switch (style.color.toLowerCase()) { case 'rgb(0, 128, 0)': case '#008000': case 'green': break; default: console.log('Invalid color:', style.color); errors = true; } toggleTest(key, errors ? 'failed' : 'success'); } else { toggleTest(key, 'failed'); } }} />

Properties

Rotation as number:{' '} { const key = 'icon-rotate2'; if (element) { toggleTest( key, element.getAttribute('rotate') !== '2' ? 'failed' : 'success' ); } else { toggleTest(key, 'failed'); } }} />
); }