From 4ca3d1dc9487be2dadd1722823f75f7146bd7a60 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Tue, 2 Aug 2016 18:48:56 +1200 Subject: [PATCH] API Allow custom 'type' option for scripts Fixes #5829 --- tests/forms/RequirementsTest.php | 22 ++++++++++++++++++++++ view/Requirements.php | 14 +++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/tests/forms/RequirementsTest.php b/tests/forms/RequirementsTest.php index f9f62a4f9..d39ece8f2 100644 --- a/tests/forms/RequirementsTest.php +++ b/tests/forms/RequirementsTest.php @@ -141,6 +141,28 @@ class RequirementsTest extends SapphireTest { ); } + public function testCustomType() { + /** @var Requirements_Backend $backend */ + $backend = Injector::inst()->create('Requirements_Backend'); + $basePath = $this->getCurrentRelativePath(); + $this->setupRequirements($backend); + + // require files normally (e.g. called from a FormField instance) + $backend->javascript($basePath . '/RequirementsTest_a.js', [ + 'type' => 'application/json' + ]); + $backend->javascript($basePath . '/RequirementsTest_b.js'); + $result = $backend->includeInHTML(self::$html_template); + $this->assertContains( + '"; + $jsRequirements .= ""; } }