Skip to content

Commit 66ead45

Browse files
committed
Merge remote-tracking branch 'trigger/nathans-bugfixes' into BugFixPR
2 parents 91d4891 + 63229e3 commit 66ead45

File tree

13 files changed

+220
-23
lines changed

13 files changed

+220
-23
lines changed

app/code/Magento/Cms/Block/Adminhtml/Block/Edit/DeleteButton.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class DeleteButton extends GenericButton implements ButtonProviderInterface
1414
{
1515
/**
16-
* @return array
16+
* @inheritDoc
1717
*/
1818
public function getButtonData()
1919
{
@@ -24,14 +24,16 @@ public function getButtonData()
2424
'class' => 'delete',
2525
'on_click' => 'deleteConfirm(\'' . __(
2626
'Are you sure you want to do this?'
27-
) . '\', \'' . $this->getDeleteUrl() . '\')',
27+
) . '\', \'' . $this->getDeleteUrl() . '\', {"data": {}})',
2828
'sort_order' => 20,
2929
];
3030
}
3131
return $data;
3232
}
3333

3434
/**
35+
* URL to send delete requests to.
36+
*
3537
* @return string
3638
*/
3739
public function getDeleteUrl()

app/code/Magento/Cms/Block/Adminhtml/Page/Edit/DeleteButton.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class DeleteButton extends GenericButton implements ButtonProviderInterface
1414
{
1515
/**
16-
* @return array
16+
* @inheritDoc
1717
*/
1818
public function getButtonData()
1919
{
@@ -24,14 +24,16 @@ public function getButtonData()
2424
'class' => 'delete',
2525
'on_click' => 'deleteConfirm(\'' . __(
2626
'Are you sure you want to do this?'
27-
) . '\', \'' . $this->getDeleteUrl() . '\')',
27+
) . '\', \'' . $this->getDeleteUrl() . '\', {"data": {}})',
2828
'sort_order' => 20,
2929
];
3030
}
3131
return $data;
3232
}
3333

3434
/**
35+
* Url to send delete requests to.
36+
*
3537
* @return string
3638
*/
3739
public function getDeleteUrl()

app/code/Magento/Cms/Test/Mftf/ActionGroup/SearchBlockOnGridPageActionGroup.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,27 @@
1616
<waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish2" />
1717
<waitForElementVisible selector="{{WidgetSection.BlockPage(Block.identifier)}}" stepKey="waitForBlockTitle" />
1818
</actionGroup>
19+
<actionGroup name ="deleteBlock">
20+
<arguments>
21+
<argument name="Block" defaultValue=""/>
22+
</arguments>
23+
<amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSBlocksGrid"/>
24+
<waitForPageLoad stepKey="waitForPageLoad1"/>
25+
<conditionalClick selector="{{BlockPageActionsSection.clearAll}}" dependentSelector="{{BlockPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/>
26+
<waitForPageLoad stepKey="waitForPageLoad2"/>
27+
<click selector="{{BlockPageActionsSection.FilterBtn}}" stepKey="clickFilterBtn"/>
28+
<fillField selector="{{BlockPageActionsSection.URLKey}}" userInput="{{Block.identifier}}" stepKey="fillBlockIdentifierInput"/>
29+
<click selector="{{BlockPageActionsSection.ApplyFiltersBtn}}" stepKey="applyFilter"/>
30+
<waitForLoadingMaskToDisappear stepKey="waitForGridToLoadResults" />
31+
<waitForElementVisible selector="{{BlockPageActionsSection.select(Block.identifier)}}" stepKey="waitForCMSPageGrid" />
32+
<click selector="{{BlockPageActionsSection.select(Block.identifier)}}" stepKey="clickSelect" />
33+
<waitForElementVisible selector="{{BlockPageActionsSection.edit(Block.identifier)}}" stepKey="waitForEditLink" />
34+
<click selector="{{BlockPageActionsSection.edit(Block.identifier)}}" stepKey="clickEdit" />
35+
<waitForLoadingMaskToDisappear stepKey="waitForPageToLoad" />
36+
<click selector="{{CmsBlockBlockActionSection.deleteBlock}}" stepKey="deleteBlock"/>
37+
<waitForElementVisible selector="{{CmsBlockBlockActionSection.deleteConfirm}}" stepKey="waitForOkButtonToBeVisible"/>
38+
<click selector="{{CmsBlockBlockActionSection.deleteConfirm}}" stepKey="clickOkButton"/>
39+
<waitForPageLoad stepKey="waitForPageLoad3"/>
40+
<see userInput="You deleted the block." stepKey="seeSuccessMessage"/>
41+
</actionGroup>
1942
</actionGroups>

app/code/Magento/Cms/Test/Mftf/Section/CmsNewBlockBlockActionsSection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@
2424
<section name="BlockContentSection">
2525
<element name="TextArea" type="input" selector="#cms_block_form_content"/>
2626
</section>
27+
<section name="CmsBlockBlockActionSection">
28+
<element name="deleteBlock" type="button" selector="#delete" timeout="30"/>
29+
<element name="deleteConfirm" type="button" selector=".action-primary.action-accept" timeout="60"/>
30+
</section>
2731
</sections>

app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/>
2424
</before>
2525
<after>
26+
<actionGroup ref="deleteBlock" stepKey="deleteCreatedBlock">
27+
<argument name="Block" value="_defaultBlock"/>
28+
</actionGroup>
2629
<actionGroup ref="logout" stepKey="logout"/>
2730
</after>
2831
<amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnBlocksCreationForm"/>

app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/BlockActionsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public function testPrepareDataSource()
9595
'title' => __('Delete %1', $title),
9696
'message' => __('Are you sure you want to delete a %1 record?', $title)
9797
],
98+
'post' => true
9899
]
99100
],
100101
]

app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function testPrepareItemsByPageId()
7070
'title' => __('Delete %1', $title),
7171
'message' => __('Are you sure you want to delete a %1 record?', $title)
7272
],
73+
'post' => true
7374
]
7475
],
7576
]

app/code/Magento/Cms/Ui/Component/Listing/Column/BlockActions.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ public function __construct(
5555
}
5656

5757
/**
58-
* Prepare Data Source
59-
*
60-
* @param array $dataSource
61-
* @return array
58+
* @inheritDoc
6259
*/
6360
public function prepareDataSource(array $dataSource)
6461
{
@@ -87,7 +84,8 @@ public function prepareDataSource(array $dataSource)
8784
'confirm' => [
8885
'title' => __('Delete %1', $title),
8986
'message' => __('Are you sure you want to delete a %1 record?', $title)
90-
]
87+
],
88+
'post' => true
9189
]
9290
];
9391
}
@@ -99,6 +97,7 @@ public function prepareDataSource(array $dataSource)
9997

10098
/**
10199
* Get instance of escaper
100+
*
102101
* @return Escaper
103102
* @deprecated 101.0.7
104103
*/

app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ public function __construct(
6767
}
6868

6969
/**
70-
* Prepare Data Source
71-
*
72-
* @param array $dataSource
73-
* @return array
70+
* @inheritDoc
7471
*/
7572
public function prepareDataSource(array $dataSource)
7673
{
@@ -89,7 +86,8 @@ public function prepareDataSource(array $dataSource)
8986
'confirm' => [
9087
'title' => __('Delete %1', $title),
9188
'message' => __('Are you sure you want to delete a %1 record?', $title)
92-
]
89+
],
90+
'post' => true
9391
];
9492
}
9593
if (isset($item['identifier'])) {
@@ -110,6 +108,7 @@ public function prepareDataSource(array $dataSource)
110108

111109
/**
112110
* Get instance of escaper
111+
*
113112
* @return Escaper
114113
* @deprecated 101.0.7
115114
*/

dev/tests/static/framework/Magento/Sniffs/Less/AvoidIdSniff.php

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* Ensure that id selector is not used
1515
*
1616
* @link http://devdocs.magento.com/guides/v2.0/coding-standards/code-standard-less.html#types
17-
*
1817
*/
1918
class AvoidIdSniff implements Sniff
2019
{
@@ -26,31 +25,75 @@ class AvoidIdSniff implements Sniff
2625
public $supportedTokenizers = [TokenizerSymbolsInterface::TOKENIZER_CSS];
2726

2827
/**
28+
* Tokens that can appear in a selector
29+
*
2930
* @var array
3031
*/
31-
private $symbolsBeforeId = [
32-
TokenizerSymbolsInterface::INDENT_SPACES,
33-
TokenizerSymbolsInterface::NEW_LINE,
32+
private $selectorTokens = [
33+
T_HASH,
34+
T_WHITESPACE,
35+
T_STRING_CONCAT,
36+
T_OPEN_PARENTHESIS,
37+
T_CLOSE_PARENTHESIS,
38+
T_OPEN_SQUARE_BRACKET,
39+
T_CLOSE_SQUARE_BRACKET,
40+
T_DOUBLE_QUOTED_STRING,
41+
T_CONSTANT_ENCAPSED_STRING,
42+
T_DOUBLE_COLON,
43+
T_COLON,
44+
T_EQUAL,
45+
T_MUL_EQUAL,
46+
T_OR_EQUAL,
47+
T_STRING,
48+
T_NONE,
49+
T_DOLLAR,
50+
T_GREATER_THAN,
51+
T_PLUS,
52+
T_NS_SEPARATOR,
53+
T_LNUMBER,
3454
];
3555

3656
/**
37-
* {@inheritdoc}
57+
* @inheritdoc
3858
*/
3959
public function register()
4060
{
4161
return [T_HASH];
4262
}
4363

4464
/**
45-
* {@inheritdoc}
65+
* @inheritdoc
66+
*
67+
* Will flag any selector that looks like the following:
68+
* #foo[bar],
69+
* #foo[bar=bash],
70+
* #foo[bar~=bash],
71+
* #foo[bar$=bash],
72+
* #foo[bar*=bash],
73+
* #foo[bar|=bash],
74+
* #foo[bar='bash'],
75+
* #foo:hover,
76+
* #foo:nth-last-of-type(n),
77+
* #foo::before,
78+
* #foo + div,
79+
* #foo > div,
80+
* #foo ~ div,
81+
* #foo\3Abar ~ div,
82+
* #foo\:bar ~ div,
83+
* #foo.bar .baz,
84+
* div#foo {
85+
* blah: 'abc';
86+
* }
4687
*/
4788
public function process(File $phpcsFile, $stackPtr)
4889
{
4990
$tokens = $phpcsFile->getTokens();
5091

51-
if (T_WHITESPACE === $tokens[$stackPtr - 1]['code']
52-
&& in_array($tokens[$stackPtr - 1]['content'], $this->symbolsBeforeId)
53-
) {
92+
// Find the next non-selector token
93+
$nextToken = $phpcsFile->findNext($this->selectorTokens, $stackPtr + 1, null, true);
94+
95+
// Anything except a { or a , means this is not a selector
96+
if ($nextToken !== false && in_array($tokens[$nextToken]['code'], [T_OPEN_CURLY_BRACKET, T_COMMA])) {
5497
$phpcsFile->addError('Id selector is used', $stackPtr, 'IdSelectorUsage');
5598
}
5699
}

0 commit comments

Comments
 (0)