Skip to content

Commit 73cc8cd

Browse files
authored
Merge pull request #16 from magento-commerce/imported-magento-magento-coding-standard-217
[Imported] Add test coverage for HtmlBindingSniff
2 parents 2e163ba + 68369d6 commit 73cc8cd

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

Magento2/Sniffs/Html/HtmlBindingSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function process(File $phpcsFile, $stackPtr)
8383
. ' - "' . $htmlBinding . '" doesn\'t,' . PHP_EOL
8484
. 'consider using text binding if the value is supposed to be text',
8585
null,
86-
'UIComponentTemplate.KnockoutBinding.HtmlSuffix'
86+
'KnockoutBindingHtmlSuffix'
8787
);
8888
}
8989
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
8+
<div data-bind="attr: test.value"></div>
9+
<p>Test</p>
10+
<span data-bind="html: testError()"></span>
11+
<div data-bind="
12+
attr : tst,
13+
html: test.getSomething().value.error()
14+
"></div>
15+
<p data-bind="html: '<b>Some html</b>', attr: test"></p>
16+
<div data-bind="html: valueUnsanitizedHtml"></div>
17+
<div data-bind="attr: testhtml, html: valueUnsanitizedHtml()"></div>
18+
<p data-bind="other_html: bind, html: bind_stuff(1, 2)"></p>
19+
20+
<div style="tst()"></div>
21+
<span html="testError()"></span>
22+
<div html="
23+
test.getSomething().value.error(1)
24+
"></div>
25+
<p html="'<b>Some html</b>'"></p>
26+
<div html="valueUnsanitizedHtml"></div>
27+
<div html="
28+
valueUnsanitizedHtml('test')
29+
"></div>
30+
<p html="bind_stuff()"></p>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento2\Tests\Html;
7+
8+
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
9+
10+
class HtmlBindingUnitTest extends AbstractSniffUnitTest
11+
{
12+
/**
13+
* @inheritdoc
14+
*/
15+
public function getErrorList()
16+
{
17+
return [1 => 6];
18+
}
19+
20+
/**
21+
* @inheritdoc
22+
*/
23+
public function getWarningList()
24+
{
25+
return [];
26+
}
27+
}

0 commit comments

Comments
 (0)