| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 12 | public function testTinyMceJavascriptIsRequiredBeforeBlocks() |
||
| 13 | { |
||
| 14 | $block = new BannerBlock; |
||
| 15 | $block->getCMSFields(); |
||
| 16 | |||
| 17 | $javascript = Requirements::backend()->getJavascript(); |
||
| 18 | |||
| 19 | // Ensure TinyMCE's scripts are loaded first |
||
| 20 | $mcePath = TinyMCEConfig::get('cms')->getScriptURL(); |
||
| 21 | $this->assertArrayHasKey($mcePath, $javascript, 'TinyMCE is loaded first'); |
||
| 22 | |||
| 23 | // By pushing the bundle reference again, the size of the requirements shouldn't change |
||
| 24 | $this->assertNotEmpty($javascript); |
||
| 25 | Requirements::javascript('silverstripe/elemental-blocks:client/dist/js/bundle.js'); |
||
| 26 | $this->assertSame( |
||
| 27 | count($javascript), |
||
| 28 | count(Requirements::backend()->getJavascript()), |
||
| 29 | 'Blocks bundle is added' |
||
| 30 | ); |
||
| 33 |