11"""
2- Tests for customizable emphasis and definition text colors.
2+ Tests for customizable emphasis and strong/bold text colors.
33
44Verifies that:
55- Theme options are registered in theme.conf
@@ -29,24 +29,24 @@ def test_emphasis_color_dark_option_exists(self):
2929 content = (THEME_DIR / "theme.conf" ).read_text ()
3030 assert "emphasis_color_dark =" in content
3131
32- def test_definition_color_option_exists (self ):
33- """theme.conf should define definition_color option."""
32+ def test_strong_color_option_exists (self ):
33+ """theme.conf should define strong_color option."""
3434 content = (THEME_DIR / "theme.conf" ).read_text ()
35- assert "definition_color =" in content
35+ assert "strong_color =" in content
3636
37- def test_definition_color_dark_option_exists (self ):
38- """theme.conf should define definition_color_dark option."""
37+ def test_strong_color_dark_option_exists (self ):
38+ """theme.conf should define strong_color_dark option."""
3939 content = (THEME_DIR / "theme.conf" ).read_text ()
40- assert "definition_color_dark =" in content
40+ assert "strong_color_dark =" in content
4141
4242 def test_options_default_to_empty (self ):
4343 """All color options should default to empty (use CSS fallback)."""
4444 content = (THEME_DIR / "theme.conf" ).read_text ()
4545 for option in [
4646 "emphasis_color" ,
4747 "emphasis_color_dark" ,
48- "definition_color " ,
49- "definition_color_dark " ,
48+ "strong_color " ,
49+ "strong_color_dark " ,
5050 ]:
5151 # Each option should appear as "option_name =" with no value
5252 # Use a targeted check to avoid matching substrings
@@ -55,53 +55,53 @@ def test_options_default_to_empty(self):
5555 line for line in lines if line .strip ().startswith (f"{ option } =" )
5656 ]
5757 assert len (matching ) == 1 , f"Expected exactly one '{ option } ' option"
58- assert matching [ 0 ]. strip () == f" { option } =" , (
59- f"' { option } ' should default to empty string "
60- )
58+ assert (
59+ matching [ 0 ]. strip () == f" { option } = "
60+ ), f"' { option } ' should default to empty string"
6161
6262
6363class TestCustomColorCSSVariables :
64- """Test that SCSS uses CSS custom properties for emphasis/definition ."""
64+ """Test that SCSS uses CSS custom properties for emphasis/strong ."""
6565
6666 def test_base_scss_uses_emphasis_variable (self ):
6767 """_base.scss should use --qe-emphasis-color CSS variable for em."""
6868 content = (ASSETS_DIR / "styles" / "_base.scss" ).read_text ()
6969 assert "var(--qe-emphasis-color" in content
7070
71- def test_base_scss_uses_definition_variable (self ):
72- """_base.scss should use --qe-definition -color CSS variable for strong."""
71+ def test_base_scss_uses_strong_variable (self ):
72+ """_base.scss should use --qe-strong -color CSS variable for strong."""
7373 content = (ASSETS_DIR / "styles" / "_base.scss" ).read_text ()
74- assert "var(--qe-definition -color" in content
74+ assert "var(--qe-strong -color" in content
7575
7676 def test_base_scss_has_emphasis_fallback (self ):
7777 """_base.scss should have SCSS fallback value for emphasis color."""
7878 content = (ASSETS_DIR / "styles" / "_base.scss" ).read_text ()
7979 assert "var(--qe-emphasis-color, colors.$emphasis)" in content
8080
81- def test_base_scss_has_definition_fallback (self ):
82- """_base.scss should have SCSS fallback value for definition color."""
81+ def test_base_scss_has_strong_fallback (self ):
82+ """_base.scss should have SCSS fallback value for strong color."""
8383 content = (ASSETS_DIR / "styles" / "_base.scss" ).read_text ()
84- assert "var(--qe-definition -color, colors.$definition)" in content
84+ assert "var(--qe-strong -color, colors.$definition)" in content
8585
8686 def test_dark_theme_uses_emphasis_variable (self ):
8787 """_dark-theme.scss should use --qe-emphasis-color CSS variable."""
8888 content = (ASSETS_DIR / "styles" / "_dark-theme.scss" ).read_text ()
8989 assert "var(--qe-emphasis-color" in content
9090
91- def test_dark_theme_uses_definition_variable (self ):
92- """_dark-theme.scss should use --qe-definition -color CSS variable."""
91+ def test_dark_theme_uses_strong_variable (self ):
92+ """_dark-theme.scss should use --qe-strong -color CSS variable."""
9393 content = (ASSETS_DIR / "styles" / "_dark-theme.scss" ).read_text ()
94- assert "var(--qe-definition -color" in content
94+ assert "var(--qe-strong -color" in content
9595
9696 def test_dark_theme_has_emphasis_fallback (self ):
9797 """_dark-theme.scss should have fallback for emphasis in dark mode."""
9898 content = (ASSETS_DIR / "styles" / "_dark-theme.scss" ).read_text ()
9999 assert "var(--qe-emphasis-color, #66bb6a)" in content
100100
101- def test_dark_theme_has_definition_fallback (self ):
102- """_dark-theme.scss should have fallback for definition in dark mode."""
101+ def test_dark_theme_has_strong_fallback (self ):
102+ """_dark-theme.scss should have fallback for strong in dark mode."""
103103 content = (ASSETS_DIR / "styles" / "_dark-theme.scss" ).read_text ()
104- assert "var(--qe-definition -color, #cd853f)" in content
104+ assert "var(--qe-strong -color, #cd853f)" in content
105105
106106
107107class TestCustomColorCompiledCSS :
@@ -113,11 +113,11 @@ def test_compiled_css_has_emphasis_variable(self):
113113 content = css_path .read_text ()
114114 assert "--qe-emphasis-color" in content
115115
116- def test_compiled_css_has_definition_variable (self ):
117- """Compiled CSS should contain --qe-definition -color variable."""
116+ def test_compiled_css_has_strong_variable (self ):
117+ """Compiled CSS should contain --qe-strong -color variable."""
118118 css_path = THEME_DIR / "static" / "styles" / "quantecon-book-theme.css"
119119 content = css_path .read_text ()
120- assert "--qe-definition -color" in content
120+ assert "--qe-strong -color" in content
121121
122122 def test_compiled_css_em_uses_variable (self ):
123123 """Compiled CSS em rule should use var(--qe-emphasis-color)."""
@@ -126,10 +126,10 @@ def test_compiled_css_em_uses_variable(self):
126126 assert "var(--qe-emphasis-color" in content
127127
128128 def test_compiled_css_strong_uses_variable (self ):
129- """Compiled CSS strong rule should use var(--qe-definition -color)."""
129+ """Compiled CSS strong rule should use var(--qe-strong -color)."""
130130 css_path = THEME_DIR / "static" / "styles" / "quantecon-book-theme.css"
131131 content = css_path .read_text ()
132- assert "var(--qe-definition -color" in content
132+ assert "var(--qe-strong -color" in content
133133
134134
135135class TestCustomColorLayoutTemplate :
@@ -143,40 +143,40 @@ def test_template_checks_emphasis_color(self):
143143 content = self ._read_layout ()
144144 assert "theme_emphasis_color" in content
145145
146- def test_template_checks_definition_color (self ):
147- """Layout template should conditionally check theme_definition_color ."""
146+ def test_template_checks_strong_color (self ):
147+ """Layout template should conditionally check theme_strong_color ."""
148148 content = self ._read_layout ()
149- assert "theme_definition_color " in content
149+ assert "theme_strong_color " in content
150150
151151 def test_template_checks_emphasis_color_dark (self ):
152152 """Layout template should conditionally check theme_emphasis_color_dark."""
153153 content = self ._read_layout ()
154154 assert "theme_emphasis_color_dark" in content
155155
156- def test_template_checks_definition_color_dark (self ):
157- """Layout template should conditionally check theme_definition_color_dark ."""
156+ def test_template_checks_strong_color_dark (self ):
157+ """Layout template should conditionally check theme_strong_color_dark ."""
158158 content = self ._read_layout ()
159- assert "theme_definition_color_dark " in content
159+ assert "theme_strong_color_dark " in content
160160
161161 def test_template_sets_emphasis_css_variable (self ):
162162 """Layout template should set --qe-emphasis-color CSS variable."""
163163 content = self ._read_layout ()
164164 assert "--qe-emphasis-color: {{ theme_emphasis_color }}" in content
165165
166- def test_template_sets_definition_css_variable (self ):
167- """Layout template should set --qe-definition -color CSS variable."""
166+ def test_template_sets_strong_css_variable (self ):
167+ """Layout template should set --qe-strong -color CSS variable."""
168168 content = self ._read_layout ()
169- assert "--qe-definition -color: {{ theme_definition_color }}" in content
169+ assert "--qe-strong -color: {{ theme_strong_color }}" in content
170170
171171 def test_template_sets_dark_emphasis_css_variable (self ):
172172 """Layout template should set --qe-emphasis-color for dark mode."""
173173 content = self ._read_layout ()
174174 assert "--qe-emphasis-color: {{ theme_emphasis_color_dark }}" in content
175175
176- def test_template_sets_dark_definition_css_variable (self ):
177- """Layout template should set --qe-definition -color for dark mode."""
176+ def test_template_sets_dark_strong_css_variable (self ):
177+ """Layout template should set --qe-strong -color for dark mode."""
178178 content = self ._read_layout ()
179- assert "--qe-definition -color: {{ theme_definition_color_dark }}" in content
179+ assert "--qe-strong -color: {{ theme_strong_color_dark }}" in content
180180
181181 def test_template_dark_mode_uses_body_dark_theme (self ):
182182 """Layout template should target body.dark-theme for dark colors."""
0 commit comments