Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
JUNCA24 RevealJS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
PGI15-Teaching
JUNCA24 RevealJS
Commits
c7db11d9
Commit
c7db11d9
authored
6 years ago
by
Hakim El Hattab
Browse files
Options
Downloads
Patches
Plain Diff
tests for plugins
parent
b180d94e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
css/reveal.scss
+1
-1
1 addition, 1 deletion
css/reveal.scss
test/test-plugins.html
+92
-0
92 additions, 0 deletions
test/test-plugins.html
with
93 additions
and
1 deletion
css/reveal.scss
+
1
−
1
View file @
c7db11d9
...
...
@@ -1591,7 +1591,7 @@ $controlsArrowAngleActive: 36deg;
}
.reveal
.hljs
[
data-line-numbers
]
:not
([
data-line-numbers
=
""
])
tr
:not
(
.highlight-line
)
{
opacity
:
0
.
25
;
opacity
:
0
.
4
;
}
...
...
This diff is collapsed.
Click to expand it.
test/test-plugins.html
0 → 100644
+
92
−
0
View file @
c7db11d9
<!doctype html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
>
<title>
reveal.js - Test Plugins
</title>
<link
rel=
"stylesheet"
href=
"../css/reveal.css"
>
<link
rel=
"stylesheet"
href=
"qunit-2.5.0.css"
>
</head>
<body
style=
"overflow: auto;"
>
<div
id=
"qunit"
></div>
<div
id=
"qunit-fixture"
></div>
<div
class=
"reveal"
style=
"display: none;"
>
<div
class=
"slides"
>
<section>
Slide content
</section>
</div>
</div>
<script
src=
"../js/reveal.js"
></script>
<script
src=
"qunit-2.5.0.js"
></script>
<script>
QUnit
.
module
(
'
Plugins
'
);
var
initCounter
=
{
PluginB
:
0
,
PluginC
:
0
,
PluginD
:
0
};
// Plugin with no init method
var
PluginA
=
{};
// Plugin with init method
var
PluginB
=
{
init
:
function
()
{
initCounter
[
'
PluginB
'
]
+=
1
;
}
};
// Async plugin with init method
var
PluginC
=
{
init
:
function
()
{
return
new
Promise
(
function
(
resolve
)
{
setTimeout
(
()
=>
{
initCounter
[
'
PluginC
'
]
+=
1
;
resolve
();
},
1000
);
});
}
};
// Plugin initialized after reveal.js is ready
var
PluginD
=
{
init
:
function
()
{
initCounter
[
'
PluginD
'
]
+=
1
;
}
};
Reveal
.
registerPlugin
(
'
PluginA
'
,
PluginA
);
Reveal
.
registerPlugin
(
'
PluginB
'
,
PluginB
);
Reveal
.
registerPlugin
(
'
PluginC
'
,
PluginC
);
Reveal
.
initialize
();
QUnit
.
test
(
'
Can initialize synchronously
'
,
function
(
assert
)
{
assert
.
strictEqual
(
initCounter
[
'
PluginB
'
],
1
);
Reveal
.
registerPlugin
(
'
PluginB
'
,
PluginB
);
assert
.
strictEqual
(
initCounter
[
'
PluginB
'
],
1
,
'
prevents duplicate registration
'
);
});
QUnit
.
test
(
'
Can initialie asynchronously
'
,
function
(
assert
)
{
assert
.
expect
(
3
);
var
done
=
assert
.
async
(
2
);
assert
.
strictEqual
(
initCounter
[
'
PluginC
'
],
0
,
'
async plugin not immediately initialized
'
);
Reveal
.
addEventListener
(
'
ready
'
,
function
()
{
assert
.
strictEqual
(
initCounter
[
'
PluginC
'
],
1
,
'
finsihed initializing when reveal.js dispatches "ready"
'
);
done
();
Reveal
.
registerPlugin
(
'
PluginD
'
,
PluginD
);
assert
.
strictEqual
(
initCounter
[
'
PluginD
'
],
1
,
'
plugin registered after reveal.js is ready still initiailizes
'
);
done
();
});
}
);
</script>
</body>
</html>
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