19 declare(strict_types=1);
21 require_once(__DIR__ .
'/ModalBase.php');
33 $interruptive = $this->
getModalFactory()->interruptive(
'myTitle',
'myMessage',
'myFormAction');
34 $this->assertEquals(
'myTitle', $interruptive->getTitle());
39 $interruptive = $this->
getModalFactory()->interruptive(
'myTitle',
'myMessage',
'myFormAction');
40 $this->assertEquals(
'myMessage', $interruptive->getMessage());
45 $interruptive = $this->
getModalFactory()->interruptive(
'myTitle',
'myMessage',
'myFormAction');
46 $this->assertEquals(
'myFormAction', $interruptive->getFormAction());
51 $interruptive = $this->
getModalFactory()->interruptive(
'myTitle',
'myMessage',
'myFormAction');
53 $interruptive = $interruptive->withAffectedItems($items);
54 $this->assertEquals($items, $interruptive->getAffectedItems());
59 $interruptive = $this->
getModalFactory()->interruptive(
'myTitle',
'myMessage',
'myFormAction');
60 $interruptive2 = $interruptive->withFormAction(
'myFormAction2');
61 $this->assertEquals(
'myFormAction', $interruptive->getFormAction());
62 $this->assertEquals(
'myFormAction2', $interruptive2->getFormAction());
67 $interruptive = $this->
getModalFactory()->interruptive(
'myTitle',
'myMessage',
'myFormAction');
69 $interruptive2 = $interruptive->withAffectedItems($items);
70 $this->assertEquals(0, count($interruptive->getAffectedItems()));
71 $this->assertEquals($items, $interruptive2->getAffectedItems());
76 $interruptive = $this->
getModalFactory()->interruptive(
'Title',
'Message',
'myAction.php');
79 $this->assertEquals($expected, $actual);
84 $interruptive = $this->
getModalFactory()->interruptive(
'Title',
'Message',
'myAction.php');
92 $interruptive = $interruptive->withAffectedItems($items);
95 $this->assertEquals($expected, $actual);
115 $expected_start = <<<EOT
116 <div
class=
"modal fade c-modal--interruptive" tabindex=
"-1" role=
"dialog" id=
"id_1">
117 <div
class=
"modal-dialog" role=
"document">
118 <
form action=
"myAction.php" method=
"POST">
119 <div
class=
"modal-content">
120 <div
class=
"modal-header"><
button type=
"button" class=
"close" data-dismiss=
"modal" aria-label=
"cancel">
121 <span aria-hidden=
"true">×</span></
button><h1
class=
"modal-title">
Title</h1>
123 <div
class=
"modal-body">
124 <div
class=
"alert alert-warning c-modal--interruptive__message" role=
"alert">Message</div>
126 $expected_items = <<<EOT
127 <div
class=
"c-modal--interruptive__items">
133 <div
class=
"c-modal--interruptive__items">
141 $expected_end = <<<EOT
143 <div
class=
"modal-footer">
144 <input type=
"submit" class=
"btn btn-primary" value=
"delete"/>
145 <
button class=
"btn btn-default" data-dismiss=
"modal">cancel</
button>
153 return $expected_start . $expected_items . $expected_end;
155 return $expected_start . $expected_end;
161 $action_label =
'actionlabel';
162 $cancel_label =
'cancellabel';
163 $interruptive = $this->
getModalFactory()->interruptive(
'Title',
'Message',
'someaction')
164 ->withActionButtonLabel($action_label)
165 ->withCancelButtonLabel($cancel_label);
169 $interruptive->getActionButtonLabel()
173 $interruptive->getCancelButtonLabel()
180 protected string $canonical_name;
184 $this->canonical_name = $canonical_name;
187 public function getId(): string
192 public function getCanonicalName(): string
194 return $this->canonical_name ?:
'InterruptiveItem';
200 public function getTitle():
string 205 public function getDescription():
string 207 return 'description';
210 public function getIcon(): C\Image\Image
212 return new I\Component\Image\Image(
C\
Image\Image::STANDARD,
'',
'');
218 public function getKey():
string getExpectedHTML(bool $with_items=false)
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
button(string $caption, string $cmd)
Tests on implementation for the interruptive modal.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Base class for modal tests.
normalizeHTML(string $html)
getKeyValueInterruptiveItem(string $canonical_name)
form( $class_path, string $cmd, string $submit_caption="")
getStandardInterruptiveItem(string $canonical_name)