Skip to content

Commit

Permalink
fix: holder not being used
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Jun 8, 2023
1 parent 760d5d9 commit bcdc2d0
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
ci:
name: CI
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.lock
/resources/
.phpunit.result.cache
/assets
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SilverStripe Elemental Virtual

[![Build Status](http://img.shields.io/travis/dnadesign/silverstripe-elemental-virtual.svg?style=flat)](https://travis-ci.org/dnadesign/silverstripe-elemental-virtual)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dnadesign/silverstripe-elemental-virtual/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dnadesign/silverstripe-elemental-virtual/?branch=master)
[![codecov](https://codecov.io/gh/dnadesign/silverstripe-elemental-virtual/branch/master/graph/badge.svg)](https://codecov.io/gh/dnadesign/silverstripe-elemental-virtual)
[![Version](http://img.shields.io/packagist/v/dnadesign/silverstripe-elemental-virtual.svg?style=flat)](https://packagist.org/packages/dnadesign/silverstripe-elemental-virtual)
Expand All @@ -14,5 +13,5 @@ linked to multiple pages.
## Installation

```
composer require dnadesign/silverstripe-elemental-virtual 1.x-dev
composer require dnadesign/silverstripe-elemental-virtual ^1
```
11 changes: 0 additions & 11 deletions src/Control/ElementVirtualLinkedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@

class ElementVirtualLinkedController extends ElementController
{

/**
* Returns the current element in scope rendered into its' holder
*
* @return HTML
*/
public function ElementHolder()
{
return $this->renderWith('ElementHolder_VirtualLinked');
}

/**
* @param string $action
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% if $LinkedElement %>
<div class="element element--virtual $LinkedElement.SimpleClassName.LowerCase<% if $LinkedElement.StyleVariant %> $LinkedElement.StyleVariant<% end_if %><% if $LinkedElement.ExtraClass %> $LinkedElement.ExtraClass<% end_if %>" id="{$LinkedElement.Anchor}">
$Element
</div>
<% end_if %>
3 changes: 0 additions & 3 deletions templates/ElementalHolder_VirtualLinked.ss

This file was deleted.

14 changes: 14 additions & 0 deletions tests/php/BaseElementExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use DNADesign\Elemental\Models\ElementalArea;
use DNADesign\Elemental\Tests\Src\TestElement;
use DNADesign\Elemental\Tests\Src\TestPage;
use DNADesign\ElementalVirtual\Control\ElementVirtualLinkedController;
use DNADesign\ElementalVirtual\Model\ElementVirtual;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\SapphireTest;
Expand Down Expand Up @@ -39,6 +40,19 @@ public function testVirtualElementAnchor()
$this->assertEquals('e' . $linked->ID, $element->getAnchor());
}


public function testRendersIntoHolder()
{
$element = $this->objFromFixture(ElementVirtual::class, 'virtual1');
$linked = $this->objFromFixture(TestElement::class, 'element1');

$controller = ElementVirtualLinkedController::create($element);

$template = $controller->forTemplate();

$this->assertStringContainsString('element--test-element', $template);
}

public function testUpdateCmsFields()
{
$linked = $this->objFromFixture(TestElement::class, 'element1');
Expand Down

0 comments on commit bcdc2d0

Please sign in to comment.