diff --git a/webpack-config/file-lists.js b/webpack-config/file-lists.js index f92664881395..6e07782ae94a 100644 --- a/webpack-config/file-lists.js +++ b/webpack-config/file-lists.js @@ -10,7 +10,12 @@ module.exports = { path.resolve(__dirname, '../common/static/common/js/components/views/paging_footer.js'), path.resolve(__dirname, '../cms/static/js/views/paging.js'), path.resolve(__dirname, '../common/static/common/js/components/utils/view_utils.js'), - /xmodule\/js\/src/, + // Files in xmodule/js/src/ that still use RequireJS (AMD) patterns. + // New files added under xmodule/js/src/ should use ES6+ — do NOT add them here. + // To migrate a file off RequireJS, remove it from this list. + path.resolve(__dirname, '../xmodule/js/src/poll/poll.js'), + path.resolve(__dirname, '../xmodule/js/src/poll/poll_main.js'), + path.resolve(__dirname, '../xmodule/js/src/video/08_video_auto_advance_control.js'), path.resolve(__dirname, '../openedx/features/course_bookmarks/static/course_bookmarks/js/views/bookmark_button.js') ], diff --git a/webpack.common.config.js b/webpack.common.config.js index cd9d0f53af59..5fccaf6ff054 100644 --- a/webpack.common.config.js +++ b/webpack.common.config.js @@ -12,7 +12,12 @@ var builtinBlocksJS = require('./webpack.builtinblocks.config.js'); var filesWithRequireJSBlocks = [ path.resolve(__dirname, 'common/static/common/js/components/utils/view_utils.js'), - /xmodule\/js\/src/ + // Files in xmodule/js/src/ that still use RequireJS (AMD) patterns. + // New files added under xmodule/js/src/ should use ES6+ — do NOT add them here. + // To migrate a file off RequireJS, remove it from this list. + path.resolve(__dirname, 'xmodule/js/src/poll/poll.js'), + path.resolve(__dirname, 'xmodule/js/src/poll/poll_main.js'), + path.resolve(__dirname, 'xmodule/js/src/video/08_video_auto_advance_control.js'), ]; var defineHeader = /\(function ?\(((define|require|requirejs|\$)(, )?)+\) ?\{/; diff --git a/xmodule/js/karma_runner_webpack.js b/xmodule/js/karma_runner_webpack.js index d00be7111757..d276e48cca96 100644 --- a/xmodule/js/karma_runner_webpack.js +++ b/xmodule/js/karma_runner_webpack.js @@ -22,7 +22,7 @@ import '../../common/static/js/test/i18n.js'; import '../../common/static/common/js/vendor/hls.js'; import '../assets/vertical/public/js/vertical_student_view.js'; -import '../../common/static/js/vendor/jasmine-imagediff.js'; +import imagediff from '../../common/static/js/vendor/jasmine-imagediff.js'; import '../../common/static/common/js/spec_helpers/jasmine-waituntil.js'; import '../../common/static/common/js/spec_helpers/jasmine-extensions.js'; import '../../common/static/common/js/vendor/sinon.js'; @@ -35,11 +35,23 @@ import StringUtils from 'edx-ui-toolkit/js/utils/string-utils'; // but not explicitly imported import 'jquery.ui'; +// Problem Block (capa) source files +import './src/xmodule.js'; +import './src/javascript_loader.js'; +import './src/collapsible.js'; +import './src/capa/display.js'; +import './src/capa/imageinput.js'; +import './src/capa/schematic.js'; + // These import '../assets/video/public/js/10_main.js'; import './spec/helper.js'; import './spec/video_helper.js'; +// Problem Block (capa) spec files +import './spec/capa/display_spec.js'; +import './spec/capa/imageinput_spec.js'; + // These are the tests that will be run import './spec/video/async_process_spec.js'; import './spec/video/completion_spec.js'; @@ -83,6 +95,7 @@ import './spec/time_spec.js'; 'use strict'; window._ = _; +window.imagediff = imagediff; window.edx = window.edx || {}; window.edx.HtmlUtils = HtmlUtils; window.edx.StringUtils = StringUtils; diff --git a/xmodule/js/karma_xmodule.conf.js b/xmodule/js/karma_xmodule.conf.js index 185e1e66883a..2cc04a7f1eec 100644 --- a/xmodule/js/karma_xmodule.conf.js +++ b/xmodule/js/karma_xmodule.conf.js @@ -74,12 +74,12 @@ var options = { {pattern: 'src/javascript_loader.js', included: true}, {pattern: 'src/collapsible.js', included: true}, // Load everything else - {pattern: 'src/**/!(video)/!(poll|time).js', included: true} + {pattern: 'src/**/!(video|capa)/!(poll|time).js', included: true} ], specFiles: [ {pattern: 'spec/helper.js', included: true, ignoreCoverage: true}, // Helper which depends on source files. - {pattern: 'spec/**/!(video)/*.js', included: true}, + {pattern: 'spec/**/!(video|capa)/*.js', included: true}, {pattern: 'spec/!(time_spec|video_helper).js', included: true} ], diff --git a/xmodule/js/src/capa/schematic.js b/xmodule/js/src/capa/schematic.js index 7004562af8ce..0babbdae525b 100644 --- a/xmodule/js/src/capa/schematic.js +++ b/xmodule/js/src/capa/schematic.js @@ -1978,7 +1978,7 @@ function update_schematics() { } window.update_schematics = update_schematics; -schematic = (function () { +var schematic = (function () { var background_style = "rgb(220,220,220)"; var element_style = "rgb(255,255,255)"; var thumb_style = "rgb(128,128,128)";