File tree 1 file changed +20
-0
lines changed 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,15 @@ public function it_does_not_allow_raw_html_on_edited_columns()
169
169
$ this ->assertNotEquals ('<a href="#">Allowed</a> ' , $ json ['data ' ][0 ]['email ' ]);
170
170
}
171
171
172
+ /** @test */
173
+ public function it_allows_raw_html_on_specified_columns ()
174
+ {
175
+ $ json = $ this ->call ('GET ' , '/query/xss-raw ' )->json ();
176
+ $ this ->assertNotEquals ('<a href="#">Allowed</a> ' , $ json ['data ' ][0 ]['foo ' ]);
177
+ $ this ->assertEquals ('<a href="#">Allowed</a> ' , $ json ['data ' ][0 ]['name ' ]);
178
+ $ this ->assertEquals ('<a href="#">Allowed</a> ' , $ json ['data ' ][0 ]['email ' ]);
179
+ }
180
+
172
181
/** @test */
173
182
public function it_can_return_auto_index_column ()
174
183
{
@@ -264,5 +273,16 @@ protected function setUp()
264
273
})
265
274
->toJson ();
266
275
});
276
+
277
+ $ route ->get ('/query/xss-raw ' , function (DataTables $ dataTable ) {
278
+ return $ dataTable ->query (DB ::table ('users ' ))
279
+ ->addColumn ('foo ' , '<a href="#">Allowed</a> ' )
280
+ ->editColumn ('name ' , '<a href="#">Allowed</a> ' )
281
+ ->editColumn ('email ' , function () {
282
+ return '<a href="#">Allowed</a> ' ;
283
+ })
284
+ ->rawColumns (['name ' , 'email ' ])
285
+ ->toJson ();
286
+ });
267
287
}
268
288
}
You can’t perform that action at this time.
0 commit comments