@@ -115,6 +115,45 @@ class Meta:
115115 assert "name" in component .get_context_data ()
116116
117117
118+ def test_meta_javascript_exclude_nested_with_tuple ():
119+ class TestComponent (UnicornView ):
120+ name = {"Universe" : {"World" : "Earth" }}
121+
122+ class Meta :
123+ javascript_exclude = ("name.Universe" ,)
124+
125+ expected = '{"name":{}}'
126+ component = TestComponent (component_id = "asdf1234" , component_name = "hello-world" )
127+ assert expected == component .get_frontend_context_variables ()
128+
129+
130+ def test_meta_javascript_exclude_nested_multiple_with_spaces ():
131+ class TestComponent (UnicornView ):
132+ name = {"Universe" : {"World" : "Earth" }}
133+ another = {"Neutral Milk Hotel" : {"album" : {"On Avery Island" : 1996 }}}
134+
135+ class Meta :
136+ javascript_exclude = ("name.Universe" , "another.Neutral Milk Hotel.album" )
137+
138+ expected = '{"another":{"Neutral Milk Hotel":{}},"name":{}}'
139+ component = TestComponent (component_id = "asdf1234" , component_name = "hello-world" )
140+ assert expected == component .get_frontend_context_variables ()
141+
142+
143+ def test_meta_javascript_exclude_nested_with_list ():
144+ class TestComponent (UnicornView ):
145+ name = {"Universe" : {"World" : "Earth" }}
146+
147+ class Meta :
148+ javascript_exclude = [
149+ "name.Universe" ,
150+ ]
151+
152+ expected = '{"name":{}}'
153+ component = TestComponent (component_id = "asdf1234" , component_name = "hello-world" )
154+ assert expected == component .get_frontend_context_variables ()
155+
156+
118157def test_meta_exclude ():
119158 class TestComponent (UnicornView ):
120159 name = "World"
0 commit comments