Skip to content

Commit

Permalink
Merge pull request #2857 from magento-tsg/2.3-develop-pr28
Browse files Browse the repository at this point in the history
[TSG] Upporting for 2.3 (pr28) (2.3.0)
  • Loading branch information
Alexander Akimov authored Jul 18, 2018
2 parents 7968f8b + 93267d8 commit 5a186a3
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if ($block->isLoggedIn()) {
$dataPostParam = sprintf(" data-post='%s'", $block->getPostParams());
}
?>
<li class="authorization-link" data-label="<?= $block->escapeHtmlAttr(__('or')) ?>">
<li class="authorization-link" data-label="<?= $block->escapeHtml(__('or')) ?>">
<a <?= /* @noEscape */ $block->getLinkAttributes() ?><?= /* @noEscape */ $dataPostParam ?>>
<?= $block->escapeHtml($block->getLabel()) ?>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
id="login-form"
data-mage-init='{"validation":{}}'>
<?= $block->getBlockHtml('formkey') ?>
<fieldset class="fieldset login" data-hasrequired="<?= $block->escapeHtmlAttr(__('* Required Fields')) ?>">
<fieldset class="fieldset login" data-hasrequired="<?= $block->escapeHtml(__('* Required Fields')) ?>">
<div class="field note"><?= $block->escapeHtml(__('If you have an account, sign in with your email address.')) ?></div>
<div class="field email required">
<label class="label" for="email"><span><?= $block->escapeHtml(__('Email')) ?></span></label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<label class="label" for="newsletter"><span><?= $block->escapeHtml(__('Sign Up for Our Newsletter:')) ?></span></label>
<div class="control">
<input name="email" type="email" id="newsletter"
placeholder="<?= $block->escapeHtmlAttr(__('Enter your email address')) ?>"
data-mage-init='{"mage/trim-input":{}}'
data-validate="{required:true, 'validate-email':true}"/>
placeholder="<?= $block->escapeHtml(__('Enter your email address')) ?>"
data-mage-init='{"mage/trim-input":{}}'
data-validate="{required:true, 'validate-email':true}"/>
</div>
</div>
<div class="actions">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

// @codingStandardsIgnoreFile

$totals = $block->getTotals();
?>
<?php if (sizeof($block->getTotals()) > 0): ?>
<?php if ($totals && count($totals) > 0): ?>
<table class="items-to-invoice">
<tr>
<?php foreach ($block->getTotals() as $_total): ?>
<td <?php if ($_total['grand']): ?>class="grand-total"<?php endif; ?>>
<?= /* @escapeNotVerified */ $_total['label'] ?><br />
<?= /* @escapeNotVerified */ $_total['value'] ?>
<?php foreach ($totals as $total): ?>
<td <?php if ($total['grand']): ?>class="grand-total"<?php endif; ?>>
<?= $block->escapeHtml($total['label']) ?><br />
<?= $block->escapeHtml($total['value']) ?>
</td>
<?php endforeach; ?>
</tr>
Expand Down
7 changes: 7 additions & 0 deletions app/code/Magento/Ui/Model/Export/MetadataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ public function getHeaders(UiComponentInterface $component)
foreach ($this->getColumns($component) as $column) {
$row[] = $column->getData('config/label');
}

array_walk($row, function (&$header) {
if (mb_strpos($header, 'ID') === 0) {
$header = '"' . $header . '"';
}
});

return $row;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,37 @@ protected function setUp()
);
}

public function testGetHeaders()
/**
* @param array $columnLabels
* @param array $expected
* @return void
* @dataProvider getColumnsDataProvider
*/
public function testGetHeaders(array $columnLabels, array $expected): void
{
$componentName = 'component_name';
$columnName = 'column_name';
$columnLabel = 'column_label';

$component = $this->prepareColumns($componentName, $columnName, $columnLabel);

$component = $this->prepareColumns($componentName, $columnName, $columnLabels[0]);
$result = $this->model->getHeaders($component);
$this->assertTrue(is_array($result));
$this->assertCount(1, $result);
$this->assertEquals($columnLabel, $result[0]);
$this->assertEquals($expected, $result);
}

/**
* @return array
*/
public function getColumnsDataProvider(): array
{
return [
[['ID'],['"ID"']],
[['Name'],['Name']],
[['Id'],['Id']],
[['id'],['id']],
[['IDTEST'],['"IDTEST"']],
[['ID TEST'],['"ID TEST"']],
];
}

public function testGetFields()
Expand Down

0 comments on commit 5a186a3

Please sign in to comment.