mirror of
https://github.com/cosmocode/dokuwiki-plugin-prosemirror.git
synced 2025-07-23 19:15:54 +00:00

These kept leaking into other commits, so here is one big change in hope of reducing future noise.
46 lines
967 B
PHP
46 lines
967 B
PHP
<?php
|
|
|
|
use dokuwiki\plugin\prosemirror\schema\Node;
|
|
use dokuwiki\plugin\prosemirror\schema\NodeStack;
|
|
|
|
/**
|
|
* NodeStack tests for the prosemirror plugin
|
|
*
|
|
* @group plugin_prosemirror
|
|
* @group plugins
|
|
*/
|
|
class nodestack_plugin_prosemirror_test extends DokuWikiTest
|
|
{
|
|
|
|
|
|
public function test_init()
|
|
{
|
|
$nodestack = new NodeStack();
|
|
$this->assertSame('doc', $nodestack->current()->getType());
|
|
}
|
|
|
|
public function test_addpop()
|
|
{
|
|
$nodestack = new NodeStack();
|
|
$node = new Node('foo');
|
|
|
|
$nodestack->addTop($node);
|
|
$this->assertSame($node, $nodestack->current());
|
|
|
|
$popped = $nodestack->drop('foo');
|
|
$this->assertSame($node, $popped);
|
|
}
|
|
|
|
public function test_dropfail()
|
|
{
|
|
$this->expectException('\\RuntimeException');
|
|
|
|
$nodestack = new NodeStack();
|
|
$node = new Node('foo');
|
|
$nodestack->addTop($node);
|
|
|
|
$nodestack->drop('baz');
|
|
}
|
|
|
|
}
|