Add CSP compliance to plugins
Change-Id: Ia13082bbad5348c8cbb5f5cb976bfe32c9fe0a27
diff --git a/t/plugin/plugins.t b/t/plugin/plugins.t
index fa5ae91..eb8b2a2 100644
--- a/t/plugin/plugins.t
+++ b/t/plugin/plugins.t
@@ -10,16 +10,16 @@
$temp->spurt(<<SCRIPT);
[{
- 'name' : 'Export',
- 'desc' : 'Exports Kalamar results',
- 'embed' : [{
- 'panel' : 'result',
- 'title' : 'exports KWICs and snippets',
- 'icon' : "\uf019",
- 'classes' : ['button-icon','plugin'],
- 'onClick' : {
- 'action' : 'addWidget',
- 'template' : 'http://localhost:7777/res/export.html'
+ "name" : "Export",
+ "desc" : "Exports Kalamar results",
+ "embed" : [{
+ "panel" : "result",
+ "title" : "exports KWICs and snippets",
+ "icon" : "\uf019",
+ "classes" : ["button-icon","plugin"],
+ "onClick" : {
+ "action" : "addWidget",
+ "template" : "http://localhost:7777/res/export.html"
}
}]
}]
@@ -31,8 +31,17 @@
$t->get_ok('/')
->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
- ->content_like(qr!KorAP\.Plugins\s*=\s*\[!)
- ->content_like(qr!<script>\/\/<\!\[CDATA\[!)
+ ->content_unlike(qr!KorAP\.Plugins\s*=\s*\[!)
+ ->content_unlike(qr!<script>\/\/<\!\[CDATA\[!)
+ ->content_like(qr!<span id="kalamar-plugins" data-plugins="/settings/plugin/list\.json"></span>!)
+ ;
+
+$t->get_ok('/settings/plugin/list.json')
+ ->status_is(200)
+ ->header_is('Content-Type','application/json;charset=UTF-8')
+ ->content_unlike(qr!KorAP\.Plugins=!)
+ ->content_like(qr!button-icon!)
+ ->json_is('/0/embed/0/title','exports KWICs and snippets')
;
done_testing;