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
a5fec26d
Commit
a5fec26d
authored
7 years ago
by
Antonio De Marco
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#120
: Fix tests.
parent
2af570a7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Plugin/PatternBase.php
+13
-11
13 additions, 11 deletions
src/Plugin/PatternBase.php
tests/src/fixtures/libraries.yml
+0
-2
0 additions, 2 deletions
tests/src/fixtures/libraries.yml
with
13 additions
and
13 deletions
src/Plugin/PatternBase.php
+
13
−
11
View file @
a5fec26d
...
...
@@ -104,17 +104,19 @@ abstract class PatternBase extends PluginBase implements PatternInterface, Conta
* Item parent set in previous recursive iteration, if any.
*/
protected
function
processLibraries
(
&
$libraries
,
$base_path
,
$parent
=
''
)
{
$parents
=
[
'js'
,
'base'
,
'layout'
,
'component'
,
'state'
,
'theme'
];
$_libraries
=
$libraries
;
foreach
(
$_libraries
as
$name
=>
$values
)
{
$is_asset
=
in_array
(
$parent
,
$parents
,
TRUE
);
$is_external
=
isset
(
$values
[
'type'
])
&&
$values
[
'type'
]
==
'external'
;
if
(
$is_asset
&&
!
$is_external
)
{
$libraries
[
$base_path
.
DIRECTORY_SEPARATOR
.
$name
]
=
$values
;
unset
(
$libraries
[
$name
]);
}
elseif
(
!
$is_asset
&&
(
$parent
!=
'dependencies'
))
{
$this
->
processLibraries
(
$libraries
[
$name
],
$base_path
,
$name
);
if
(
!
is_string
(
$libraries
))
{
$parents
=
[
'js'
,
'base'
,
'layout'
,
'component'
,
'state'
,
'theme'
];
$_libraries
=
$libraries
;
foreach
(
$_libraries
as
$name
=>
$values
)
{
$is_asset
=
in_array
(
$parent
,
$parents
,
TRUE
);
$is_external
=
isset
(
$values
[
'type'
])
&&
$values
[
'type'
]
==
'external'
;
if
(
$is_asset
&&
!
$is_external
)
{
$libraries
[
$base_path
.
DIRECTORY_SEPARATOR
.
$name
]
=
$values
;
unset
(
$libraries
[
$name
]);
}
elseif
(
!
$is_asset
)
{
$this
->
processLibraries
(
$libraries
[
$name
],
$base_path
,
$name
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/src/fixtures/libraries.yml
+
0
−
2
View file @
a5fec26d
...
...
@@ -73,7 +73,6 @@
http://example.com/external.min.js
:
{
type
:
external
,
minified
:
true
}
/pattern/base/path/library_two.js
:
{}
-
actual
:
id
:
pattern_name
...
...
@@ -82,7 +81,6 @@
-
drupal/library_two
expected
:
[]
-
actual
:
id
:
pattern_name
...
...
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