+ Outer provider with flag disabled
+
+ Inner provider with flag enabled
+
+ ,
+ )
+
+ // Inner provider enables the flag, so attribute should be set
+ expect(document.body.hasAttribute('data-dialog-scroll-optimized')).toBe(true)
+
+ unmount()
+
+ expect(document.body.hasAttribute('data-dialog-scroll-optimized')).toBe(false)
+ })
+
+ it('should only remove attribute when all providers with flag enabled have unmounted', () => {
+ expect(document.body.hasAttribute('data-dialog-scroll-optimized')).toBe(false)
+
+ // Mount three providers with flag enabled
+ const {unmount: unmount1} = render(
+