Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ui_patterns
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
ui_patterns
Commits
b3a3f421
Commit
b3a3f421
authored
6 months ago
by
Mikael Meulle
Browse files
Options
Downloads
Patches
Plain Diff
added tests
parent
a03e4004
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/Kernel/PropTypeNormalization/LinksPropTypeTest.php
+26
-3
26 additions, 3 deletions
tests/src/Kernel/PropTypeNormalization/LinksPropTypeTest.php
with
26 additions
and
3 deletions
tests/src/Kernel/PropTypeNormalization/LinksPropTypeTest.php
+
26
−
3
View file @
b3a3f421
...
...
@@ -28,6 +28,32 @@ class LinksPropTypeTest extends PropTypeNormalizationTestBase {
$this
->
assertEquals
(
$normalized
,
$expected
);
}
/**
* Test normalize static method with manual data.
*/
public
function
testNormalizationManualData
()
:
void
{
$tests
=
[
"Menu, as generated by the Menu module"
=>
self
::
menu
(),
"Standardized structure, flat, with objects"
=>
self
::
standardizedFlatObjects
(),
];
foreach
(
$tests
as
$test
)
{
$value
=
$test
[
0
];
$expected
=
$test
[
1
];
$normalized
=
LinksPropType
::
normalize
(
$value
,
$this
->
testComponentProps
[
'links'
]);
$n_items
=
count
(
$normalized
);
$this
->
assertCount
(
count
(
$expected
),
$normalized
);
for
(
$i
=
0
;
$i
<
$n_items
;
$i
++
)
{
$item
=
array_pop
(
$normalized
);
$expected_item
=
array_pop
(
$expected
);
foreach
(
$expected_item
as
$key
=>
$value
)
{
$this
->
assertEquals
(
$value
,
$item
[
$key
]
??
NULL
);
break
;
}
}
// $this->assertEquals($normalized, $expected);
}
}
/**
* Test rendered component with prop.
*
...
...
@@ -108,13 +134,10 @@ class LinksPropTypeTest extends PropTypeNormalizationTestBase {
],
],
"Standardized structure, flat, only primitives"
=>
self
::
standardizedFlatPrimitives
(),
// "Standardized structure, flat, with objects" =>
// self::standardizedFlatObjects(),
"Breadcrumb structure, as generated by the core service"
=>
self
::
breadcrumb
(),
"Mini pager, as generated by the Views module"
=>
self
::
viewsMiniPager
(),
"Pager's pages, as generated by the Views module"
=>
self
::
pagerPages
(),
"Pager's navigation links, as generated by the Views module"
=>
self
::
pagesNavigationLinks
(),
// "Menu, as generated by the Menu module" => self::menu(),
"Where link_attributes is already manually set"
=>
self
::
linkAttributes
(),
];
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment