Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
acid-block
Overview
Overview
Details
Activity
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
edx
acid-block
Commits
43ebb814
Commit
43ebb814
authored
Feb 13, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test of resources url
parent
9c832513
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
6 deletions
+39
-6
MANIFEST.in
+2
-0
acid/acid.py
+1
-0
acid/public/test_data.json
+2
-0
acid/static/html/acid.html.mako
+6
-0
acid/static/js/acid.js
+15
-0
setup.py
+13
-6
No files found.
MANIFEST.in
0 → 100644
View file @
43ebb814
recursive-include acid/static *
recursive-include acid/public *
acid/acid.py
View file @
43ebb814
...
...
@@ -180,6 +180,7 @@ class AcidBlock(XBlock):
acid_child_count
=
len
([
child
for
child
in
children
if
child
.
scope_ids
.
block_type
==
'acid'
]),
rendered_children
=
(
fragment
.
content
for
fragment
in
rendered_children
),
storage_tests
=
scope_test_contexts
,
local_resource_url
=
self
.
runtime
.
local_resource_url
(
self
,
'public/test_data.json'
),
))
frag
.
add_frags_resources
(
rendered_children
)
...
...
acid/public/test_data.json
0 → 100644
View file @
43ebb814
{
"test_data"
:
"success"
}
\ No newline at end of file
acid/static/html/acid.html.mako
View file @
43ebb814
...
...
@@ -6,6 +6,7 @@
data-error-class="${error_class}"
data-unknown-class="${unknown_class}"
data-acid-child-count="${acid_child_count}"
data-local-resource-url="${local_resource_url}"
>
<script class="acid-child-values" type="application/json">
${json.dumps(acid_child_values)}
...
...
@@ -32,6 +33,11 @@
<i class="${unknown_class}"></i>
</span>
</p>
<p>Resource Url Test:
<span class="local-resource-test">
<i class="${unknown_class}"></i>
</span>
</p>
<table class='storage-tests'>
<tr>
<th>Scope</th>
...
...
acid/static/js/acid.js
View file @
43ebb814
...
...
@@ -25,6 +25,20 @@ function AcidBlock(runtime, element) {
}
}
function
resourceTests
()
{
$
.
get
(
acidData
(
'local-resource-url'
))
.
fail
(
function
()
{
mark
(
'failure'
,
'.local-resource-test'
,
element
,
'Unable to load local resource'
);
})
.
done
(
function
(
data
)
{
if
(
data
.
test_data
==
'success'
)
{
mark
(
'success'
,
'.local-resource-test'
);
}
else
{
mark
(
'failure'
,
'.local-resource-test'
,
element
,
'Data mismatch'
);
}
});
}
function
childTests
()
{
if
(
acidData
(
'acid-child-count'
)
==
runtime
.
children
(
element
).
length
)
{
mark
(
'success'
,
'.child-counts-match'
);
...
...
@@ -84,6 +98,7 @@ function AcidBlock(runtime, element) {
mark
(
'success'
,
'.document-ready-run'
);
childTests
();
resourceTests
();
scopeTests
();
});
...
...
setup.py
View file @
43ebb814
"""Set up for XBlock acid block."""
import
os
from
setuptools
import
setup
def
package_data
(
pkg
,
roots
):
"""Generic function to find package_data for `pkg` under `root`."""
data
=
[]
for
root
in
roots
:
for
dirname
,
_
,
files
in
os
.
walk
(
os
.
path
.
join
(
pkg
,
root
)):
for
fname
in
files
:
data
.
append
(
os
.
path
.
relpath
(
os
.
path
.
join
(
dirname
,
fname
),
pkg
))
return
{
pkg
:
data
}
setup
(
name
=
'acid-xblock'
,
version
=
'0.1'
,
...
...
@@ -19,10 +31,5 @@ setup(
'acid = acid:AcidBlock'
,
],
},
package_data
=
{
'acid'
:
[
'static/*/*.*'
,
'static/*/*/*.*'
,
],
},
package_data
=
package_data
(
"acid"
,
[
"static"
,
"public"
]),
)
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