@@ -127,6 +127,49 @@ def test_self_closing_tag(self, create_bird_template):
127127 rendered = template .render (context = Context ({}))
128128 assert rendered == "<img src='image' />"
129129
130+ @pytest .mark .parametrize (
131+ "component,template,context,expected" ,
132+ [
133+ (
134+ "<button>{{ slot }}</button>" ,
135+ "{% bird button %}Click me{% endbird %}" ,
136+ {},
137+ "<button>Click me</button>" ,
138+ ),
139+ (
140+ "<button>{% bird:slot %}{% endbird:slot %}</button>" ,
141+ "{% bird button %}Click me{% endbird %}" ,
142+ {},
143+ "<button>Click me</button>" ,
144+ ),
145+ (
146+ "<button>{% bird:slot default %}{% endbird:slot %}</button>" ,
147+ "{% bird button %}Click me{% endbird %}" ,
148+ {},
149+ "<button>Click me</button>" ,
150+ ),
151+ (
152+ "<button><span>{% bird:slot leading-icon %}{% endbird:slot %}</span>{{ slot }}</button>" ,
153+ "{% bird button %}{% bird:slot leading-icon %}Icon here{% endbird:slot %}Click me{% endbird %}" ,
154+ {},
155+ "<button><span>Icon here</span>Click me</button>" ,
156+ ),
157+ ],
158+ )
159+ def test_with_slots (
160+ self ,
161+ component ,
162+ template ,
163+ context ,
164+ expected ,
165+ create_bird_template ,
166+ normalize_whitespace ,
167+ ):
168+ create_bird_template ("button" , component )
169+ t = Template (template )
170+ rendered = t .render (context = Context (context ))
171+ assert normalize_whitespace (rendered ) == expected
172+
130173
131174@pytest .mark .xfail (reason = "Feature not implemented yet" )
132175class TestBirdTemplateTagFutureFeatures :
0 commit comments