|
| 1 | +/** |
| 2 | + * Copyright 2026 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +import {describe, it, expect} from 'vitest'; |
| 17 | +import {render} from '@testing-library/react'; |
| 18 | +import React from 'react'; |
| 19 | +import {A2UIProvider} from '../../../../src/v0_8'; |
| 20 | +import {resetStyles} from '../../../../src/v0_8/styles/reset'; |
| 21 | +describe('SVG Reset Exclusion', () => { |
| 22 | + it('should have the correct CSS selector in resetStyles', () => { |
| 23 | + expect(resetStyles).toContain(':not(svg, svg *:not(foreignObject *))'); |
| 24 | + }); |
| 25 | + it('should allow presentational attributes on SVG elements', () => { |
| 26 | + const {container} = render( |
| 27 | + <A2UIProvider> |
| 28 | + <div className="a2ui-surface"> |
| 29 | + <svg fill="red" data-testid="test-svg" width="100" height="100"> |
| 30 | + <circle cx="50" cy="50" r="40" /> |
| 31 | + </svg> |
| 32 | + </div> |
| 33 | + </A2UIProvider>, |
| 34 | + ); |
| 35 | + const svg = container.querySelector('svg'); |
| 36 | + expect(svg).toBeInTheDocument(); |
| 37 | + expect(svg).toHaveAttribute('fill', 'red'); |
| 38 | + }); |
| 39 | +}); |
0 commit comments