Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
35438ade
Commit
35438ade
authored
Feb 27, 2020
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused Angular directive utility functions
parent
dea8d9e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
49 deletions
+0
-49
util.js
src/sidebar/directive/test/util.js
+0
-49
No files found.
src/sidebar/directive/test/util.js
View file @
35438ade
...
...
@@ -10,30 +10,6 @@ function hyphenate(name) {
return
name
.
replace
(
uppercasePattern
,
'-$1'
).
toLowerCase
();
}
/**
* Helper for retrieving an Angular module in a test.
*
* Given the 'inject' function from the 'angular-mocks' module,
* retrieves an instance of the specified Angular module.
*/
export
function
ngModule
(
inject
,
name
)
{
let
module
;
const
helper
=
function
(
_module
)
{
module
=
_module
;
};
// Tell Angular which module we want using $inject
// annotations. These take priority over function argument names.
helper
.
$inject
=
[
name
];
// inject() creates a new 'angular.$injector' service instance
// for the current test, if one has not already been created and then
// calls the passed function, injecting the modules it depends upon.
inject
(
helper
);
return
module
;
}
/**
* A helper for instantiating an AngularJS directive in a unit test.
*
...
...
@@ -176,28 +152,3 @@ export function sendEvent(element, eventType) {
const
event
=
new
Event
(
eventType
,
{
bubbles
:
true
,
cancelable
:
true
});
element
.
dispatchEvent
(
event
);
}
/**
* Return true if a given element is hidden on the page.
*
* There are many possible ways of hiding DOM elements on a page, this just
* looks for approaches that are common in our app.
*/
export
function
isHidden
(
element
)
{
const
style
=
window
.
getComputedStyle
(
element
);
if
(
style
.
display
===
'none'
)
{
return
true
;
}
// Test for element or ancestor being hidden with `ng-hide` directive
let
el
=
element
;
while
(
el
)
{
if
(
el
.
classList
.
contains
(
'ng-hide'
))
{
return
true
;
}
el
=
el
.
parentElement
;
}
return
false
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment