@@ -71,15 +71,30 @@ final class LayerTreeBuilderTests: XCTestCase {
7171 let circle = DOM . Circle ( cx: 5 , cy: 5 , r: 5 )
7272 let svg = DOM . SVG ( width: 10 , height: 10 )
7373 svg. defs. clipPaths. append ( DOM . ClipPath ( id: " clip1 " , childElements: [ circle] ) )
74+
75+ var attributes = DOM . PresentationAttributes ( )
76+ attributes. clipPath = URL ( string: " #clip1 " )
77+ svg. styles = [ DOM . StyleSheet ( attributes: [ . class( " a " ) : attributes] ) ]
78+
7479 let builder = LayerTree . Builder ( svg: svg)
7580
76- let element = DOM . GraphicsElement ( )
81+ var element = DOM . GraphicsElement ( )
7782 element. attributes. clipPath = URL ( string: " #clip1 " )
7883
79- let shapes = builder. createClipShapes ( for: element)
80- XCTAssertEqual ( shapes, [ . ellipse( within: LayerTree . Rect ( x: 0 , y: 0 , width: 10 , height: 10 ) ) ] )
84+ var shapes = builder. createClipShapes ( for: element)
85+ XCTAssertEqual (
86+ builder. createClipShapes ( for: element) ,
87+ [ . ellipse( within: LayerTree . Rect ( x: 0 , y: 0 , width: 10 , height: 10 ) ) ]
88+ )
89+
90+ element = DOM . GraphicsElement ( )
91+ element. class = " a "
92+ XCTAssertEqual (
93+ builder. createClipShapes ( for: element) ,
94+ [ . ellipse( within: LayerTree . Rect ( x: 0 , y: 0 , width: 10 , height: 10 ) ) ]
95+ )
8196 }
82-
97+
8398 func testDOMGroupMakesChildContents( ) {
8499 let builder = LayerTree . Builder ( svg: DOM . SVG ( width: 10 , height: 10 ) )
85100
0 commit comments