From c422e06b6005d9d5691b61ca0d8ff7b1f80c715a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 9 Feb 2012 11:15:31 +0100 Subject: [PATCH] MINOR Removed GridField->requireDefaultCSS() idiom, not used elsewhere (or used for JS in the same class), should be handled through Requirements class instead --- forms/gridfield/GridField.php | 9 ++------- tests/forms/GridFieldTest.php | 3 --- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/forms/gridfield/GridField.php b/forms/gridfield/GridField.php index 61610ed55..f03b9e3fd 100755 --- a/forms/gridfield/GridField.php +++ b/forms/gridfield/GridField.php @@ -144,13 +144,6 @@ class GridField extends FormField { $this->components = $config->getComponents(); return $this; } - - /** - * Require the default css styling - */ - protected function requireDefaultCSS() { - Requirements::css('sapphire/css/GridField.css'); - } /** * Get the DisplayFields @@ -713,6 +706,8 @@ class GridField_Action extends FormAction { * @return string HTML tag */ public function Field() { + Requirements::css('sapphire/css/GridField.css'); + Requirements::javascript(SAPPHIRE_DIR.'/thirdparty/jquery/jquery.js'); Requirements::javascript(SAPPHIRE_DIR.'/thirdparty/json-js/json2.js'); Requirements::javascript(SAPPHIRE_DIR.'/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js'); diff --git a/tests/forms/GridFieldTest.php b/tests/forms/GridFieldTest.php index 385a8f5b4..91a54ed70 100644 --- a/tests/forms/GridFieldTest.php +++ b/tests/forms/GridFieldTest.php @@ -3,13 +3,10 @@ class GridFieldtest extends SapphireTest { /** * @covers GridField::__construct - * @covers GridFIeld::requireDefaultCSS */ public function testGridField() { $obj = new GridField('testfield', 'testfield'); $this->assertTrue($obj instanceof GridField, 'Test that the constructor arguments are valid'); - $css = Requirements::backend()->get_css(); - $this->assertTrue(isset($css['sapphire/css/GridField.css']), 'GridField.css should have been aquired'); } /**