From 82e09531a25b608280fa555d0b62fb56d2125c37 Mon Sep 17 00:00:00 2001 From: Ethan Setnik Date: Tue, 17 Nov 2026 12:29:51 -0500 Subject: [PATCH] fix: style the popup container in the bundled stylesheets Since 1.3.3 the popup renders its content in `.rc-tooltip-container` (it was `-inner` up to 1.2.2 and `-body` in 1.3.0 to 1.3.2), but `assets/bootstrap.less` and `assets/bootstrap_white.less` still style `.rc-tooltip-inner`. Anyone importing `assets/bootstrap.css` or `assets/bootstrap_white.css` gets a tooltip with no background, padding or text color. Rename the rule in both themes, and add a test that the stylesheets style the class the popup renders. Co-Authored-By: Claude Opus 5.5 --- assets/bootstrap.less | 2 +- assets/bootstrap_white.less | 2 +- tests/assets.test.tsx | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tests/assets.test.tsx diff --git a/assets/bootstrap.less b/assets/bootstrap.less index 5a0767a4..95fed5ca 100644 --- a/assets/bootstrap.less +++ b/assets/bootstrap.less @@ -54,7 +54,7 @@ } // Wrapper for the tooltip content -.@{tooltip-prefix-cls}-inner { +.@{tooltip-prefix-cls}-container { padding: 8px 10px; color: @tooltip-color; text-align: left; diff --git a/assets/bootstrap_white.less b/assets/bootstrap_white.less index e123dd12..b85797c4 100644 --- a/assets/bootstrap_white.less +++ b/assets/bootstrap_white.less @@ -44,7 +44,7 @@ } // Wrapper for the tooltip content -.@{tooltip-prefix-cls}-inner { +.@{tooltip-prefix-cls}-container { padding: 8px 10px; color: @tooltip-color; text-align: left; diff --git a/tests/assets.test.tsx b/tests/assets.test.tsx new file mode 100644 index 00000000..2190073f --- /dev/null +++ b/tests/assets.test.tsx @@ -0,0 +1,25 @@ +import fs from 'fs'; +import path from 'path'; +import React from 'react'; +import { render } from '@testing-library/react'; +import Tooltip from '../src'; + +describe('assets', () => { + it('style the element the popup renders its content in', () => { + render( + + Target + , + ); + const content = document.querySelector('[role="tooltip"]'); + + expect(content.className).toContain('rc-tooltip-container'); + + ['bootstrap.less', 'bootstrap_white.less'].forEach((file) => { + const less = fs.readFileSync(path.join(__dirname, '..', 'assets', file), 'utf8'); + + expect(less).toContain('.@{tooltip-prefix-cls}-container {'); + expect(less).not.toContain('.@{tooltip-prefix-cls}-inner {'); + }); + }); +});