Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions src/xblock_annotatable/assets/fixtures/annotatable.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<section class='xblock xblock-student_view xmodule_display xmodule_AnnotatableModule' data-type='Annotatable'>
<div class="annotatable-wrapper">
<div class="annotatable-header">
<h3 class="hd hd-2 annotatable-title">First Annotation Exercise</h2>
</div>
<div class="annotatable-section">
<div class="annotatable-section-title">
Instructions
<a class="annotatable-toggle annotatable-toggle-instructions expanded" href="javascript:void(0)">Collapse Instructions</a>
</div>
<div class="annotatable-section-body annotatable-instructions">
<div><p>The main goal of this exercise is to start practicing the art of slow reading.</p></div>
</div>
</div>
<div class="annotatable-section">
<div class="annotatable-section-title">
Guided Discussion
<a class="annotatable-toggle annotatable-toggle-annotations" href="javascript:void(0)">Hide Annotations</a>
</div>
</div>
<div class="annotatable-content">
|87 No, those who are really responsible are Zeus and Fate [Moira] and the Fury [Erinys] who roams in the mist. <br/>
|88 <span data-problem-id="0" data-comment-body="Agamemnon says..." class="annotatable-span highlight" data-comment-title="Your Title Here">They are the ones who</span><br/>
|100 He [= Zeus], making a formal declaration [eukhesthai], spoke up at a meeting of all the gods and said: <br/>
|101 <span data-problem-id="1" data-comment-body="When Zeus speaks..." class="annotatable-span highlight">“hear me, all gods and all goddesses,</span><br/>
|113 but he swore a great oath.
<span data-problem-id="2" data-comment-body="How is the ‘veering off-course’ ..." class="annotatable-span highlight">And right then and there</span><br/>
</div>
</div>
</section>

<div class="problem"><a class="annotation-return" href="javascript:void(0)">Return to Annotation</a></div>
<div class="problem"><a class="annotation-return" href="javascript:void(0)">Return to Annotation</a></div>
<div class="problem"><a class="annotation-return" href="javascript:void(0)">Return to Annotation</a></div>
51 changes: 51 additions & 0 deletions src/xblock_annotatable/assets/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* eslint-env node */
'use strict';

module.exports = function (config) {
config.set({
basePath: '',

frameworks: ['jasmine'],

files: [
{ pattern: require.resolve('jquery/dist/jquery.js'), included: true },
{ pattern: require.resolve('jasmine-jquery/lib/jasmine-jquery.js'), included: true },

{ pattern: 'spec_helpers/*.js', included: true },

{ pattern: '../static/js/src/annotatable.js', included: true },

{ pattern: 'fixtures/**/*.html', included: false, served: true },

{ pattern: 'spec/*_spec.js', included: true }
],

plugins: [
'karma-jasmine',
'karma-firefox-launcher',
require('karma-spec-reporter')
],

reporters: ['spec'],

port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['FirefoxNoUpdates'],

customLaunchers: {
FirefoxNoUpdates: {
base: 'Firefox',
prefs: {
'app.update.auto': false,
'app.update.enabled': false
}
}
},

singleRun: true,
concurrency: Infinity,
client: { captureConsole: true }
});
};
18 changes: 18 additions & 0 deletions src/xblock_annotatable/assets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "annotatable-xblock",
"private": true,
"description": "Annotatable XBlock.",
"scripts": {
"test": "karma start karma.conf.js",
"test-ci": "xvfb-run --auto-servernum karma start karma.conf.js"
},
"devDependencies": {
"jasmine-core": "2.6.4",
"jasmine-jquery": "git+https://git@github.com/velesin/jasmine-jquery.git#ebad463d592d3fea00c69f26ea18a930e09c7b58",
"jquery": "^2",
"karma": "^0.13",
"karma-firefox-launcher": "^2",
"karma-jasmine": "^0.3",
"karma-spec-reporter": "0.0.20"
}
}
18 changes: 18 additions & 0 deletions src/xblock_annotatable/assets/spec/annotatable_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Ported from openedx-platform `xmodule/js/spec/annotatable/display_spec.js`
* (removed by openedx/openedx-platform#38746, Slash-n-Burn epic openedx/openedx-platform#37819).
* The fixture `fixtures/annotatable.html` is copied unchanged from `xmodule/js/fixtures/annotatable.html`.
*
* Only adaptation: the extracted block's initializer is the XBlock-style `Annotatable(runtime, element)`
* instead of the built-in `new Annotatable(el)`.
*/
describe('Annotatable', function() {
beforeEach(() => loadFixtures('annotatable.html'));
describe('constructor', function() {
const el = $('.xblock-student_view.xmodule_AnnotatableModule');
beforeEach(function() {
this.annotatable = new Annotatable({}, el);
});
it('works', () => expect(1).toBe(1));
});
});
18 changes: 18 additions & 0 deletions src/xblock_annotatable/assets/spec_helpers/helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Test environment for the Annotatable XBlock JS specs.
*
* In the LMS, the jQuery qTip plugin is loaded globally and annotatable.js calls
* `$(el).qtip(...)` on each highlighted span. The openedx-platform karma setup loaded the
* real vendor plugin; here a no-op stub is enough for the constructor to run.
*/
(function($) {
'use strict';

if (!$.fn.qtip) {
$.fn.qtip = function() {
return this;
};
}

jasmine.getFixtures().fixturesPath = 'base/fixtures';
}(jQuery));
Loading