From f288575919b852d0346d105e2f554e841ca4703a Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 9 Mar 2012 18:11:26 +1300 Subject: [PATCH] MINOR: Removed obsolete test. --- .../gridfield/GridFieldToolbarHeaderTest.php | 58 ------------------- .../gridfield/GridFieldToolbarHeaderTest.yml | 5 -- 2 files changed, 63 deletions(-) delete mode 100644 tests/forms/gridfield/GridFieldToolbarHeaderTest.php delete mode 100644 tests/forms/gridfield/GridFieldToolbarHeaderTest.yml diff --git a/tests/forms/gridfield/GridFieldToolbarHeaderTest.php b/tests/forms/gridfield/GridFieldToolbarHeaderTest.php deleted file mode 100644 index ae6558e1d5e..00000000000 --- a/tests/forms/gridfield/GridFieldToolbarHeaderTest.php +++ /dev/null @@ -1,58 +0,0 @@ -logInWithPermission('ADMIN'); - //construct a fake form field to render out the grid field within it - $config = new GridFieldConfig(); - $config->addComponent($titleField = new GridFieldToolbarHeader()); - $actions = new FieldList(); - $grid = new GridField('TestField', 'Test Field', new DataList('GridFieldToolbarHeaderTest_Company'),$config); - $fields = new FieldList($rootTab = new TabSet("Root",$tabMain = new Tab('Main',$grid))); - $form = new Form(Controller::curr(), "TestForm", $fields, $actions); - - $titleField->setNewEnabled(true); - $html = $form->forTemplate(); - $this->assertContains('data-icon="add"', $html,"HTML contains the 'add new' button"); - } - - public function testGridTitleAddNewDisabled() { - $this->logInWithPermission('ADMIN'); - //construct a fake form field to render out the grid field within it - $config = new GridFieldConfig(); - $config->addComponent($titleField = new GridFieldToolbarHeader()); - $actions = new FieldList(); - $grid = new GridField('TestField', 'Test Field', new DataList('GridFieldToolbarHeaderTest_Company'),$config); - $fields = new FieldList($rootTab = new TabSet("Root",$tabMain = new Tab('Main',$grid))); - $form = new Form(Controller::curr(), "TestForm", $fields, $actions); - - $titleField->setNewEnabled(false); - $html = $form->forTemplate(); - $this->assertNotContains('data-icon="add"', $html,"HTML does not contain the 'add new' button"); - } - - public function testGridTitleAddNewWithoutPermission() { - if(Member::currentUser()) { Member::currentUser()->logOut(); } - $config = new GridFieldConfig(); - $config->addComponent($titleField = new GridFieldToolbarHeader()); - $grid = new GridField('TestField', 'Test Field', new DataList('GridFieldToolbarHeaderTest_Company'),$config); - $fields = new FieldList(new TabSet("Root",$tabMain = new Tab('Main',$grid))); - $form = new Form(Controller::curr(), "TestForm", $fields, new FieldList()); - - $html = $form->forTemplate(); - $this->assertNotContains('data-icon="add"', $html, "HTML should not contain the 'add new' button"); - } -} -class GridFieldToolbarHeaderTest_Company extends DataObject implements TestOnly { - - public static $db = array( - 'Name' => 'Varchar(100)' - ); - -} diff --git a/tests/forms/gridfield/GridFieldToolbarHeaderTest.yml b/tests/forms/gridfield/GridFieldToolbarHeaderTest.yml deleted file mode 100644 index 88156d5df82..00000000000 --- a/tests/forms/gridfield/GridFieldToolbarHeaderTest.yml +++ /dev/null @@ -1,5 +0,0 @@ -GridFieldToolbarHeaderTest_Company: - test-company-1: - Name: Test company 1 - test-company-2: - Name: Test company 2