|
|
@@ -73,5 +73,58 @@ final class SpreadsheetMarkdownIntegrationTests extends TestCase {
|
|
73
|
73
|
$actual = $this->md($markdown);
|
|
74
|
74
|
$this->assertSame($expected, $actual);
|
|
75
|
75
|
}
|
|
|
76
|
+
|
|
|
77
|
+ public function test_styledValue() {
|
|
|
78
|
+ $markdown = "| A | B | C |\n| --- | --- | --- |\n| **3** | _4_ | =A*B |";
|
|
|
79
|
+ $expected = '<table><thead>' .
|
|
|
80
|
+ '<tr><th>A</th><th>B</th><th>C</th></tr>' .
|
|
|
81
|
+ '</thead><tbody><tr>' .
|
|
|
82
|
+ '<td class="spreadsheet-type-number" data-numeric-value="3" data-string-value="3"><strong>3</strong></td>' .
|
|
|
83
|
+ '<td class="spreadsheet-type-number" data-numeric-value="4" data-string-value="4"><em>4</em></td>' .
|
|
|
84
|
+ '<td class="calculated spreadsheet-type-number" data-numeric-value="12" data-string-value="12">12</td>' .
|
|
|
85
|
+ '</tr></tbody></table>';
|
|
|
86
|
+ $actual = $this->md($markdown);
|
|
|
87
|
+ $this->assertSame($expected, $actual);
|
|
|
88
|
+ }
|
|
|
89
|
+
|
|
|
90
|
+ public function test_styledFormula() {
|
|
|
91
|
+ $markdown = "| A | B | C |\n| --- | --- | --- |\n| 3 | 4 | **=A*B** |";
|
|
|
92
|
+ $expected = '<table><thead>' .
|
|
|
93
|
+ '<tr><th>A</th><th>B</th><th>C</th></tr>' .
|
|
|
94
|
+ '</thead><tbody><tr>' .
|
|
|
95
|
+ '<td class="spreadsheet-type-number" data-numeric-value="3" data-string-value="3">3</td>' .
|
|
|
96
|
+ '<td class="spreadsheet-type-number" data-numeric-value="4" data-string-value="4">4</td>' .
|
|
|
97
|
+ '<td class="calculated spreadsheet-type-number" data-numeric-value="12" data-string-value="12"><strong>12</strong></td>' .
|
|
|
98
|
+ '</tr></tbody></table>';
|
|
|
99
|
+ $actual = $this->md($markdown);
|
|
|
100
|
+ $this->assertSame($expected, $actual);
|
|
|
101
|
+ }
|
|
|
102
|
+
|
|
|
103
|
+ public function test_styledFormula_multiple() {
|
|
|
104
|
+ $markdown = "| A | B | C |\n| --- | --- | --- |\n| 3 | 4 | ~~**=A*B**~~ |";
|
|
|
105
|
+ $expected = '<table><thead>' .
|
|
|
106
|
+ '<tr><th>A</th><th>B</th><th>C</th></tr>' .
|
|
|
107
|
+ '</thead><tbody><tr>' .
|
|
|
108
|
+ '<td class="spreadsheet-type-number" data-numeric-value="3" data-string-value="3">3</td>' .
|
|
|
109
|
+ '<td class="spreadsheet-type-number" data-numeric-value="4" data-string-value="4">4</td>' .
|
|
|
110
|
+ '<td class="calculated spreadsheet-type-number" data-numeric-value="12" data-string-value="12"><s><strong>12</strong></s></td>' .
|
|
|
111
|
+ '</tr></tbody></table>';
|
|
|
112
|
+ $actual = $this->md($markdown);
|
|
|
113
|
+ $this->assertSame($expected, $actual);
|
|
|
114
|
+ }
|
|
|
115
|
+
|
|
|
116
|
+ public function test_preservedOperators() {
|
|
|
117
|
+ // Regular markdown will want to convert *B* into emphasized B
|
|
|
118
|
+ $markdown = "| A | B | C |\n| --- | --- | --- |\n| 3 | 4 | =A*B*4 |";
|
|
|
119
|
+ $expected = '<table><thead>' .
|
|
|
120
|
+ '<tr><th>A</th><th>B</th><th>C</th></tr>' .
|
|
|
121
|
+ '</thead><tbody><tr>' .
|
|
|
122
|
+ '<td class="spreadsheet-type-number" data-numeric-value="3" data-string-value="3">3</td>' .
|
|
|
123
|
+ '<td class="spreadsheet-type-number" data-numeric-value="4" data-string-value="4">4</td>' .
|
|
|
124
|
+ '<td class="calculated spreadsheet-type-number" data-numeric-value="48" data-string-value="48">48</td>' .
|
|
|
125
|
+ '</tr></tbody></table>';
|
|
|
126
|
+ $actual = $this->md($markdown);
|
|
|
127
|
+ $this->assertSame($expected, $actual);
|
|
|
128
|
+ }
|
|
76
|
129
|
}
|
|
77
|
130
|
?>
|