From 684b98505d5a5833ac7781ccde996ce2d963829c Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 30 Oct 2012 10:41:02 -0400 Subject: [PATCH 1/9] Make rake commands to run jasmine tests in browser and via phantomjs --- .gitmodules | 3 + Gemfile | 2 + {cms => common}/templates/jasmine/base.html | 5 +- common/test/phantom-jasmine | 1 + lms/templates/jasmine/base.html | 67 --------------------- rakefile | 46 ++++++++++++++ 6 files changed, 56 insertions(+), 68 deletions(-) rename {cms => common}/templates/jasmine/base.html (87%) create mode 160000 common/test/phantom-jasmine delete mode 100644 lms/templates/jasmine/base.html diff --git a/.gitmodules b/.gitmodules index e69de29bb2..3c8158cf80 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "common/test/phantom-jasmine"] + path = common/test/phantom-jasmine + url = https://github.com/jcarver989/phantom-jasmine.git diff --git a/Gemfile b/Gemfile index 9ad08c7adb..0fe7df217d 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,5 @@ ruby "1.9.3" gem 'rake' gem 'sass', '3.1.15' gem 'bourbon', '~> 1.3.6' +gem 'colorize' +gem 'launchy' diff --git a/cms/templates/jasmine/base.html b/common/templates/jasmine/base.html similarity index 87% rename from cms/templates/jasmine/base.html rename to common/templates/jasmine/base.html index 0cbf63bb29..96507bdebf 100644 --- a/cms/templates/jasmine/base.html +++ b/common/templates/jasmine/base.html @@ -11,6 +11,7 @@ + {# source files #} {% for url in suite.js_files %} @@ -19,7 +20,7 @@ {% load compressed %} {# static files #} - {% compressed_js 'main' %} + {% compressed_js 'js-test-source' %} {# spec files #} {% compressed_js 'spec' %} @@ -31,6 +32,7 @@ - - - - {# source files #} - {% for url in suite.js_files %} - - {% endfor %} - - {% load compressed %} - {# static files #} - {% compressed_js 'application' %} - {% compressed_js 'module-js' %} - - {# spec files #} - {% compressed_js 'spec' %} - - - - -

Jasmine Spec Runner

- - - - - diff --git a/rakefile b/rakefile index 90cd5fe87f..ad02355f74 100644 --- a/rakefile +++ b/rakefile @@ -1,5 +1,8 @@ require 'rake/clean' require 'tempfile' +require 'net/http' +require 'launchy' +require 'colorize' # Build Constants REPO_ROOT = File.dirname(__FILE__) @@ -38,6 +41,32 @@ def django_admin(system, env, command, *args) return "#{django_admin} #{command} --settings=#{system}.envs.#{env} --pythonpath=. #{args.join(' ')}" end +def django_for_jasmine(system) + django_pid = fork do + exec(*django_admin(system, 'dev', 'runserver', '12345').split(' ')) + end + puts django_pid + jasmine_url = 'http://localhost:12345/_jasmine/' + up = false + until up do + begin + response = Net::HTTP.get_response(URI(jasmine_url)) + puts response.code + up = response.code == '200' + rescue => e + puts e.message + ensure + puts('Waiting server to start') + sleep(0.5) + end + end + begin + yield jasmine_url + ensure + Process.kill(:SIGKILL, -Process.getpgid(django_pid)) + Process.wait(django_pid) + end +end task :default => [:test, :pep8, :pylint] directory REPORT_DIR @@ -80,6 +109,23 @@ end end end task :pylint => "pylint_#{system}" + + desc "Open jasmine tests in your default browser" + task "browse_jasmine_#{system}" do + django_for_jasmine(system) do |jasmine_url| + Launchy.open(jasmine_url) + puts "Press ENTER to terminate".red + $stdin.gets + end + end + + desc "Use phantomjs to run jasmine tests from the console" + task "phantomjs_jasmine_#{system}" do + phantomjs = ENV['PHANTOMJS_PATH'] || 'phantomjs' + django_for_jasmine(system) do |jasmine_url| + sh("#{phantomjs} common/test/phantom-jasmine/lib/run_jasmine_test.coffee #{jasmine_url}") + end + end end $failed_tests = 0 From 6d5a1264b9a582bc02c0557e86c7e54046dfccda Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 30 Oct 2012 10:58:38 -0400 Subject: [PATCH 2/9] Move jasmine tests to their own environment --- cms/envs/jasmine.py | 31 +++++++++++++++++++++++++++++++ cms/urls.py | 2 +- lms/envs/common.py | 7 ++----- lms/envs/jasmine.py | 31 +++++++++++++++++++++++++++++++ lms/urls.py | 2 +- rakefile | 2 +- 6 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 cms/envs/jasmine.py create mode 100644 lms/envs/jasmine.py diff --git a/cms/envs/jasmine.py b/cms/envs/jasmine.py new file mode 100644 index 0000000000..f85edc59a0 --- /dev/null +++ b/cms/envs/jasmine.py @@ -0,0 +1,31 @@ +""" +This configuration is used for running jasmine tests +""" + +from .test import * +from logsettings import get_logger_config + +ENABLE_JASMINE = True +DEBUG = True + +LOGGING = get_logger_config(ENV_ROOT / "log", + logging_env="dev", + tracking_filename="tracking.log", + dev_env=True, + debug=True) + +PIPELINE_JS['js-test-source'] = { + 'source_filenames': sum([ + pipeline_group['source_filenames'] + for pipeline_group + in PIPELINE_JS.values() + ], []), + 'output_filename': 'js/cms-test-source.js' +} + +PIPELINE_JS['spec'] = { + 'source_filenames': sorted(rooted_glob(PROJECT_ROOT / 'static/', 'coffee/spec/**/*.coffee')), + 'output_filename': 'js/cms-spec.js' +} + +STATICFILES_DIRS.append(COMMON_ROOT / 'test' / 'phantom-jasmine' / 'lib') diff --git a/cms/urls.py b/cms/urls.py index 7b3dd90a0b..8ff4e67a46 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -68,7 +68,7 @@ urlpatterns += ( ) -if settings.DEBUG: +if settings.ENABLE_JASMINE: ## Jasmine urlpatterns = urlpatterns + (url(r'^_jasmine/', include('django_jasmine.urls')),) diff --git a/lms/envs/common.py b/lms/envs/common.py index 62d0db9577..6889181713 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -446,16 +446,13 @@ PIPELINE_JS = { 'source_filenames': module_js, 'output_filename': 'js/lms-modules.js', }, - 'spec': { - 'source_filenames': sorted(rooted_glob(PROJECT_ROOT / 'static/', 'coffee/spec/**/*.coffee')), - 'output_filename': 'js/lms-spec.js' - }, 'discussion': { 'source_filenames': discussion_js, 'output_filename': 'js/discussion.js' - } + }, } + PIPELINE_DISABLE_WRAPPER = True # Compile all coffee files in course data directories if they are out of date. diff --git a/lms/envs/jasmine.py b/lms/envs/jasmine.py new file mode 100644 index 0000000000..e90fd2e101 --- /dev/null +++ b/lms/envs/jasmine.py @@ -0,0 +1,31 @@ +""" +This configuration is used for running jasmine tests +""" + +from .test import * +from logsettings import get_logger_config + +ENABLE_JASMINE = True +DEBUG = True + +LOGGING = get_logger_config(ENV_ROOT / "log", + logging_env="dev", + tracking_filename="tracking.log", + dev_env=True, + debug=True) + +PIPELINE_JS['js-test-source'] = { + 'source_filenames': sum([ + pipeline_group['source_filenames'] + for pipeline_group + in PIPELINE_JS.values() + ], []), + 'output_filename': 'js/lms-test-source.js' +} + +PIPELINE_JS['spec'] = { + 'source_filenames': sorted(rooted_glob(PROJECT_ROOT / 'static/', 'coffee/spec/**/*.coffee')), + 'output_filename': 'js/lms-spec.js' +} + +STATICFILES_DIRS.append(COMMON_ROOT / 'test' / 'phantom-jasmine' / 'lib') diff --git a/lms/urls.py b/lms/urls.py index 8cc81a438b..d8a80a370f 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -242,7 +242,7 @@ if settings.QUICKEDIT: urlpatterns += (url(r'^dogfood/(?P[^/]*)$', 'dogfood.views.df_capa_problem'),) -if settings.DEBUG: +if settings.ENABLE_JASMINE: ## Jasmine and admin urlpatterns=urlpatterns + (url(r'^_jasmine/', include('django_jasmine.urls')), url(r'^admin/', include(admin.site.urls)), diff --git a/rakefile b/rakefile index ad02355f74..e0972df12a 100644 --- a/rakefile +++ b/rakefile @@ -43,7 +43,7 @@ end def django_for_jasmine(system) django_pid = fork do - exec(*django_admin(system, 'dev', 'runserver', '12345').split(' ')) + exec(*django_admin(system, 'jasmine', 'runserver', '12345').split(' ')) end puts django_pid jasmine_url = 'http://localhost:12345/_jasmine/' From e8be6b3111a6728eaf76a1cb7fd5c825a877c73a Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 30 Oct 2012 11:33:21 -0400 Subject: [PATCH 3/9] Get jasmine tests running on cms --- cms/envs/common.py | 11 +---------- cms/envs/jasmine.py | 4 ++++ lms/envs/common.py | 3 --- lms/envs/jasmine.py | 4 ++++ 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index b04c423732..f110ede87a 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -68,9 +68,7 @@ MAKO_TEMPLATES['main'] = [ for namespace, template_dirs in lms.envs.common.MAKO_TEMPLATES.iteritems(): MAKO_TEMPLATES['lms.' + namespace] = template_dirs -TEMPLATE_DIRS = ( - PROJECT_ROOT / "templates", -) +TEMPLATE_DIRS = MAKO_TEMPLATES['main'] MITX_ROOT_URL = '' @@ -88,10 +86,6 @@ TEMPLATE_CONTEXT_PROCESSORS = ( LMS_BASE = None -################################# Jasmine ################################### -JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee' - - #################### CAPA External Code Evaluation ############################# XQUEUE_INTERFACE = { 'url': 'http://localhost:8888', @@ -289,7 +283,4 @@ INSTALLED_APPS = ( # For asset pipelining 'pipeline', 'staticfiles', - - # For testing - 'django_jasmine', ) diff --git a/cms/envs/jasmine.py b/cms/envs/jasmine.py index f85edc59a0..b42744a520 100644 --- a/cms/envs/jasmine.py +++ b/cms/envs/jasmine.py @@ -28,4 +28,8 @@ PIPELINE_JS['spec'] = { 'output_filename': 'js/cms-spec.js' } +JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee' + STATICFILES_DIRS.append(COMMON_ROOT / 'test' / 'phantom-jasmine' / 'lib') + +INSTALLED_APPS += ('django_jasmine', ) diff --git a/lms/envs/common.py b/lms/envs/common.py index 6889181713..251427d014 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -537,9 +537,6 @@ INSTALLED_APPS = ( 'wiki.plugins.notifications', 'course_wiki.plugins.markdownedx', - # For testing - 'django_jasmine', - # Discussion 'django_comment_client', diff --git a/lms/envs/jasmine.py b/lms/envs/jasmine.py index e90fd2e101..43459f79aa 100644 --- a/lms/envs/jasmine.py +++ b/lms/envs/jasmine.py @@ -28,4 +28,8 @@ PIPELINE_JS['spec'] = { 'output_filename': 'js/lms-spec.js' } +JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee' + STATICFILES_DIRS.append(COMMON_ROOT / 'test' / 'phantom-jasmine' / 'lib') + +INSTALLED_APPS += ('django_jasmine', ) From cd9fbaeb024262f7f15f76581de8746d945af483 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 30 Oct 2012 15:51:21 -0400 Subject: [PATCH 4/9] Add timeout so that jasmine tests eventually fail if the server doesn't start --- cms/envs/common.py | 1 + lms/envs/common.py | 1 + rakefile | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/cms/envs/common.py b/cms/envs/common.py index f110ede87a..4b4b69ad39 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -35,6 +35,7 @@ MITX_FEATURES = { 'ENABLE_DISCUSSION_SERVICE': False, 'AUTH_USE_MIT_CERTIFICATES' : False, } +ENABLE_JASMINE = False # needed to use lms student app GENERATE_RANDOM_USER_CREDENTIALS = False diff --git a/lms/envs/common.py b/lms/envs/common.py index 251427d014..2af62182ac 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -30,6 +30,7 @@ from .discussionsettings import * ################################### FEATURES ################################### COURSEWARE_ENABLED = True +ENABLE_JASMINE = False GENERATE_RANDOM_USER_CREDENTIALS = False PERFSTATS = False diff --git a/rakefile b/rakefile index e0972df12a..5cdc5b3214 100644 --- a/rakefile +++ b/rakefile @@ -48,7 +48,11 @@ def django_for_jasmine(system) puts django_pid jasmine_url = 'http://localhost:12345/_jasmine/' up = false + start_time = Time.now until up do + if Time.now - start_time > 30 + abort "Timed out waiting for server to start to run jasmine tests" + end begin response = Net::HTTP.get_response(URI(jasmine_url)) puts response.code From 6221baf3e5755c1398215efc4fac6c684daf8910 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 30 Oct 2012 15:58:59 -0400 Subject: [PATCH 5/9] Use TEST_ROOT log directory when running jasmine tests --- cms/envs/jasmine.py | 2 +- lms/envs/jasmine.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/envs/jasmine.py b/cms/envs/jasmine.py index b42744a520..f8ed6e0beb 100644 --- a/cms/envs/jasmine.py +++ b/cms/envs/jasmine.py @@ -8,7 +8,7 @@ from logsettings import get_logger_config ENABLE_JASMINE = True DEBUG = True -LOGGING = get_logger_config(ENV_ROOT / "log", +LOGGING = get_logger_config(TEST_ROOT / "log", logging_env="dev", tracking_filename="tracking.log", dev_env=True, diff --git a/lms/envs/jasmine.py b/lms/envs/jasmine.py index 43459f79aa..14c504e34f 100644 --- a/lms/envs/jasmine.py +++ b/lms/envs/jasmine.py @@ -8,7 +8,7 @@ from logsettings import get_logger_config ENABLE_JASMINE = True DEBUG = True -LOGGING = get_logger_config(ENV_ROOT / "log", +LOGGING = get_logger_config(TEST_ROOT / "log", logging_env="dev", tracking_filename="tracking.log", dev_env=True, From 0674d4e74b0c5bc784b8f5663c9234e15984fec5 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 30 Oct 2012 16:16:09 -0400 Subject: [PATCH 6/9] Only allow django-admin to run in reload mode when browsing jasmine tests, and only kill the whole process group in that case (so as to know kill jenkins) --- rakefile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/rakefile b/rakefile index 5cdc5b3214..e22b19df0c 100644 --- a/rakefile +++ b/rakefile @@ -41,9 +41,13 @@ def django_admin(system, env, command, *args) return "#{django_admin} #{command} --settings=#{system}.envs.#{env} --pythonpath=. #{args.join(' ')}" end -def django_for_jasmine(system) +def django_for_jasmine(system, django_reload) + if !django_reload + reload_arg = '--noreload' + end + django_pid = fork do - exec(*django_admin(system, 'jasmine', 'runserver', '12345').split(' ')) + exec(*django_admin(system, 'jasmine', 'runserver', "12345", reload_arg).split(' ')) end puts django_pid jasmine_url = 'http://localhost:12345/_jasmine/' @@ -67,7 +71,11 @@ def django_for_jasmine(system) begin yield jasmine_url ensure - Process.kill(:SIGKILL, -Process.getpgid(django_pid)) + if django_reload + Process.kill(:SIGKILL, -Process.getpgid(django_pid)) + else + Process.kill(:SIGKILL, django_pid) + end Process.wait(django_pid) end end @@ -116,7 +124,7 @@ end desc "Open jasmine tests in your default browser" task "browse_jasmine_#{system}" do - django_for_jasmine(system) do |jasmine_url| + django_for_jasmine(system, true) do |jasmine_url| Launchy.open(jasmine_url) puts "Press ENTER to terminate".red $stdin.gets @@ -126,7 +134,7 @@ end desc "Use phantomjs to run jasmine tests from the console" task "phantomjs_jasmine_#{system}" do phantomjs = ENV['PHANTOMJS_PATH'] || 'phantomjs' - django_for_jasmine(system) do |jasmine_url| + django_for_jasmine(system, false) do |jasmine_url| sh("#{phantomjs} common/test/phantom-jasmine/lib/run_jasmine_test.coffee #{jasmine_url}") end end From 8d4ee3b05ee632fa8a0b032f941ee8bf198f5120 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 31 Oct 2012 10:37:21 -0400 Subject: [PATCH 7/9] Add more documentation of development tasks --- doc/development.md | 78 +++++++++++++++++++++++++++++++++------------- rakefile | 14 +++++++++ 2 files changed, 71 insertions(+), 21 deletions(-) diff --git a/doc/development.md b/doc/development.md index b4ac52d202..c38cda56ff 100644 --- a/doc/development.md +++ b/doc/development.md @@ -1,35 +1,53 @@ -# Running the CMS +# Development Tasks -One can start the CMS by running `rake cms`. This will run the server on localhost -port 8001. +## Prerequisites -However, the server also needs data to work from. +### Ruby -## Installing Mongodb +To install all of the libraries needed for our rake commands, run `bundle install`. +This will read the `Gemfile` and install all of the gems specified there. -Please see http://www.mongodb.org/downloads for more detailed instructions. +### Python -### Ubuntu +In order, run the following: - sudo apt-get install mongodb + pip install -r pre-requirements.txt + pip install -r requirements.txt + pip install -r test-requirements.txt -### OSX +### Binaries -Use the MacPorts package `mongodb` or the Homebrew formula `mongodb` +Install the following: -## Initializing Mongodb +* Mongodb (http://www.mongodb.org/) -Check out the course data directories that you want to work with into the -`GITHUB_REPO_ROOT` (by default, `../data`). Then run the following command: +### Databases +Run the following to setup the relational database before starting servers: - rake django-admin[import,cms,dev,../data] + rake resetdb -Replace `../data` with your `GITHUB_REPO_ROOT` if it's not the default value. +## Starting development servers -This will import all courses in your data directory into mongodb +Both the LMS and Studio can be started using the following shortcut tasks -## Unit tests + rake lms # Start the LMS + rake cms # Start studio + +Under the hood, this executes `django-admin.py runserver --pythonpath=$WORKING_DIRECTORY --settings=lms.envs.dev`, +which starts a local development server. + +Both of these commands take arguments to start the servers in different environments +or with additional options: + + # Start the LMS using the test configuration, on port 5000 + rake lms[test,5000] # Executes django-admin.py runserver --pythonpath=$WORKING_DIRECTORY --setings=lms.envs.test 5000 + +*N.B.* You may have to escape the `[` characters, depending on your shell: `rake "lms[test,5000]"` + +## Running tests + +### Python Tests This runs all the tests (long, uses collectstatic): @@ -43,10 +61,6 @@ xmodule can be tested independently, with this: rake test_common/lib/xmodule -To see all available rake commands, do this: - - rake -T - To run a single django test class: django-admin.py test --settings=lms.envs.test --pythonpath=. lms/djangoapps/courseware/tests/tests.py:TestViewAuth @@ -67,6 +81,28 @@ To run a single nose test: Very handy: if you uncomment the `--pdb` argument in `NOSE_ARGS` in `lms/envs/test.py`, it will drop you into pdb on error. This lets you go up and down the stack and see what the values of the variables are. Check out http://docs.python.org/library/pdb.html +### Javascript Tests + +These commands start a development server with jasmine testing enabled, and launch your default browser +pointing to those tests + + rake browse_jasmine_{lms,cms} + +To run the tests headless, you must install phantomjs (http://phantomjs.org/download.html). + + rake phantomjs_jasmine_{lms,cms} + +If the `phantomjs` binary is not on the path, set the `PHANTOMJS_PATH` environment variable to point to it + + PHANTOMJS_PATH=/path/to/phantomjs rake phantomjs_jasmine_{lms,cms} + + +## Getting More Information + +Run the following to see a list of all rake tasks available and their arguments + + rake -T + ## Content development If you change course content, while running the LMS in dev mode, it is unnecessary to restart to refresh the modulestore. diff --git a/rakefile b/rakefile index e22b19df0c..798898310e 100644 --- a/rakefile +++ b/rakefile @@ -197,6 +197,20 @@ TEST_TASKS = [] end end + +desc "Reset the relational database used by django. WARNING: this will delete all of your existing users" +task :resetdb, [:env] do |t, args| + args.with_defaults(:env => 'dev') + sh(django_admin(:lms, args.env, 'syncdb')) + sh(django_admin(:lms, args.env, 'migrate')) +end + +desc "Update the relational database to the latest migration" +task :migrate, [:env] do |t, args| + args.with_defaults(:env => 'dev') + sh(django_admin(:lms, args.env, 'migrate')) +end + Dir["common/lib/*"].each do |lib| task_name = "test_#{lib}" From 2ca63268d6c7082c2e19868456750eda3f663db0 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 31 Oct 2012 10:39:26 -0400 Subject: [PATCH 8/9] Add commands for Studio LMS --- doc/development.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/development.md b/doc/development.md index c38cda56ff..d68b49228e 100644 --- a/doc/development.md +++ b/doc/development.md @@ -33,6 +33,8 @@ Both the LMS and Studio can be started using the following shortcut tasks rake lms # Start the LMS rake cms # Start studio + rake lms[cms.dev] # Start LMS to run alongside Studio + rake lms[cms.dev_preview] # Start LMS to run alongside Studio in preview mode Under the hood, this executes `django-admin.py runserver --pythonpath=$WORKING_DIRECTORY --settings=lms.envs.dev`, which starts a local development server. From 255720abd7d059d772b3666ea9defc8da05516f3 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 31 Oct 2012 13:21:36 -0400 Subject: [PATCH 9/9] Clean old javascript tests from CAS --- cms/envs/jasmine.py | 5 +- cms/static/coffee/spec/main_spec.coffee | 66 --------- .../coffee/spec/models/module_spec.coffee | 73 +--------- .../coffee/spec/views/course_spec.coffee | 85 ------------ .../coffee/spec/views/module_edit_spec.coffee | 129 +++++++++--------- .../coffee/spec/views/module_spec.coffee | 24 ---- .../coffee/spec/views/week_edit_spec.coffee | 7 - cms/static/coffee/spec/views/week_spec.coffee | 67 --------- cms/static/coffee/src/main.coffee | 26 ---- .../coffee/src/models/new_module.coffee | 5 - cms/static/coffee/src/views/course.coffee | 28 ---- cms/static/coffee/src/views/module.coffee | 14 -- cms/static/coffee/src/views/module_add.coffee | 26 ---- cms/static/coffee/src/views/week.coffee | 32 ----- cms/static/coffee/src/views/week_edit.coffee | 3 - lms/envs/jasmine.py | 5 +- rakefile | 1 - 17 files changed, 68 insertions(+), 528 deletions(-) delete mode 100644 cms/static/coffee/spec/views/course_spec.coffee delete mode 100644 cms/static/coffee/spec/views/module_spec.coffee delete mode 100644 cms/static/coffee/spec/views/week_edit_spec.coffee delete mode 100644 cms/static/coffee/spec/views/week_spec.coffee delete mode 100644 cms/static/coffee/src/models/new_module.coffee delete mode 100644 cms/static/coffee/src/views/course.coffee delete mode 100644 cms/static/coffee/src/views/module.coffee delete mode 100644 cms/static/coffee/src/views/module_add.coffee delete mode 100644 cms/static/coffee/src/views/week.coffee delete mode 100644 cms/static/coffee/src/views/week_edit.coffee diff --git a/cms/envs/jasmine.py b/cms/envs/jasmine.py index f8ed6e0beb..b29e170411 100644 --- a/cms/envs/jasmine.py +++ b/cms/envs/jasmine.py @@ -17,8 +17,9 @@ LOGGING = get_logger_config(TEST_ROOT / "log", PIPELINE_JS['js-test-source'] = { 'source_filenames': sum([ pipeline_group['source_filenames'] - for pipeline_group - in PIPELINE_JS.values() + for group_name, pipeline_group + in PIPELINE_JS.items() + if group_name != 'spec' ], []), 'output_filename': 'js/cms-test-source.js' } diff --git a/cms/static/coffee/spec/main_spec.coffee b/cms/static/coffee/spec/main_spec.coffee index 72800cec7f..8b2fa52866 100644 --- a/cms/static/coffee/spec/main_spec.coffee +++ b/cms/static/coffee/spec/main_spec.coffee @@ -8,72 +8,6 @@ describe "CMS", -> it "should initialize Views", -> expect(CMS.Views).toBeDefined() - describe "start", -> - beforeEach -> - @element = $("
") - spyOn(CMS.Views, "Course").andReturn(jasmine.createSpyObj("Course", ["render"])) - CMS.start(@element) - - it "create the Course", -> - expect(CMS.Views.Course).toHaveBeenCalledWith(el: @element) - expect(CMS.Views.Course().render).toHaveBeenCalled() - - describe "view stack", -> - beforeEach -> - @currentView = jasmine.createSpy("currentView") - CMS.viewStack = [@currentView] - - describe "replaceView", -> - beforeEach -> - @newView = jasmine.createSpy("newView") - CMS.on("content.show", (@expectedView) =>) - CMS.replaceView(@newView) - - it "replace the views on the viewStack", -> - expect(CMS.viewStack).toEqual([@newView]) - - it "trigger content.show on CMS", -> - expect(@expectedView).toEqual(@newView) - - describe "pushView", -> - beforeEach -> - @newView = jasmine.createSpy("newView") - CMS.on("content.show", (@expectedView) =>) - CMS.pushView(@newView) - - it "push new view onto viewStack", -> - expect(CMS.viewStack).toEqual([@currentView, @newView]) - - it "trigger content.show on CMS", -> - expect(@expectedView).toEqual(@newView) - - describe "popView", -> - it "remove the current view from the viewStack", -> - CMS.popView() - expect(CMS.viewStack).toEqual([]) - - describe "when there's no view on the viewStack", -> - beforeEach -> - CMS.viewStack = [@currentView] - CMS.on("content.hide", => @eventTriggered = true) - CMS.popView() - - it "trigger content.hide on CMS", -> - expect(@eventTriggered).toBeTruthy - - describe "when there's previous view on the viewStack", -> - beforeEach -> - @parentView = jasmine.createSpyObj("parentView", ["delegateEvents"]) - CMS.viewStack = [@parentView, @currentView] - CMS.on("content.show", (@expectedView) =>) - CMS.popView() - - it "trigger content.show with the previous view on CMS", -> - expect(@expectedView).toEqual @parentView - - it "re-bind events on the view", -> - expect(@parentView.delegateEvents).toHaveBeenCalled() - describe "main helper", -> beforeEach -> @previousAjaxSettings = $.extend(true, {}, $.ajaxSettings) diff --git a/cms/static/coffee/spec/models/module_spec.coffee b/cms/static/coffee/spec/models/module_spec.coffee index 8fd552d93c..5fd447539f 100644 --- a/cms/static/coffee/spec/models/module_spec.coffee +++ b/cms/static/coffee/spec/models/module_spec.coffee @@ -3,75 +3,4 @@ describe "CMS.Models.Module", -> expect(new CMS.Models.Module().url).toEqual("/save_item") it "set the correct default", -> - expect(new CMS.Models.Module().defaults).toEqual({data: ""}) - - describe "loadModule", -> - describe "when the module exists", -> - beforeEach -> - @fakeModule = jasmine.createSpy("fakeModuleObject") - window.FakeModule = jasmine.createSpy("FakeModule").andReturn(@fakeModule) - @module = new CMS.Models.Module(type: "FakeModule") - @stubDiv = $('
') - @stubElement = $('
') - @stubElement.data('type', "FakeModule") - - @stubDiv.append(@stubElement) - @module.loadModule(@stubDiv) - - afterEach -> - window.FakeModule = undefined - - it "initialize the module", -> - expect(window.FakeModule).toHaveBeenCalled() - # Need to compare underlying nodes, because jquery selectors - # aren't equal even when they point to the same node. - # http://stackoverflow.com/questions/9505437/how-to-test-jquery-with-jasmine-for-element-id-if-used-as-this - expectedNode = @stubElement[0] - actualNode = window.FakeModule.mostRecentCall.args[0][0] - - expect(actualNode).toEqual(expectedNode) - expect(@module.module).toEqual(@fakeModule) - - describe "when the module does not exists", -> - beforeEach -> - @previousConsole = window.console - window.console = jasmine.createSpyObj("fakeConsole", ["error"]) - @module = new CMS.Models.Module(type: "HTML") - @module.loadModule($("
")) - - afterEach -> - window.console = @previousConsole - - it "print out error to log", -> - expect(window.console.error).toHaveBeenCalled() - expect(window.console.error.mostRecentCall.args[0]).toMatch("^Unable to load") - - - describe "editUrl", -> - it "construct the correct URL based on id", -> - expect(new CMS.Models.Module(id: "i4x://mit.edu/module/html_123").editUrl()) - .toEqual("/edit_item?id=i4x%3A%2F%2Fmit.edu%2Fmodule%2Fhtml_123") - - describe "save", -> - beforeEach -> - spyOn(Backbone.Model.prototype, "save") - @module = new CMS.Models.Module() - - describe "when the module exists", -> - beforeEach -> - @module.module = jasmine.createSpyObj("FakeModule", ["save"]) - @module.module.save.andReturn("module data") - @module.save() - - it "set the data and call save on the module", -> - expect(@module.get("data")).toEqual("\"module data\"") - - it "call save on the backbone model", -> - expect(Backbone.Model.prototype.save).toHaveBeenCalled() - - describe "when the module does not exists", -> - beforeEach -> - @module.save() - - it "call save on the backbone model", -> - expect(Backbone.Model.prototype.save).toHaveBeenCalled() + expect(new CMS.Models.Module().defaults).toEqual(undefined) diff --git a/cms/static/coffee/spec/views/course_spec.coffee b/cms/static/coffee/spec/views/course_spec.coffee deleted file mode 100644 index f6a430ac2d..0000000000 --- a/cms/static/coffee/spec/views/course_spec.coffee +++ /dev/null @@ -1,85 +0,0 @@ -describe "CMS.Views.Course", -> - beforeEach -> - setFixtures """ -
-
-
    -
  1. -
  2. -
-
- """ - CMS.unbind() - - describe "render", -> - beforeEach -> - spyOn(CMS.Views, "Week").andReturn(jasmine.createSpyObj("Week", ["render"])) - new CMS.Views.Course(el: $("#main-section")).render() - - it "create week view for each week",-> - expect(CMS.Views.Week.calls[0].args[0]) - .toEqual({ el: $(".week-one").get(0), height: 101 }) - expect(CMS.Views.Week.calls[1].args[0]) - .toEqual({ el: $(".week-two").get(0), height: 101 }) - - describe "on content.show", -> - beforeEach -> - @view = new CMS.Views.Course(el: $("#main-section")) - @subView = jasmine.createSpyObj("subView", ["render"]) - @subView.render.andReturn(el: "Subview Content") - spyOn(@view, "contentHeight").andReturn(100) - CMS.trigger("content.show", @subView) - - afterEach -> - $("body").removeClass("content") - - it "add content class to body", -> - expect($("body").attr("class")).toEqual("content") - - it "replace content in .main-content", -> - expect($(".main-content")).toHaveHtml("Subview Content") - - it "set height on calendar", -> - expect($(".cal")).toHaveCss(height: "100px") - - it "set minimum height on all sections", -> - expect($("#main-section>section")).toHaveCss(minHeight: "100px") - - describe "on content.hide", -> - beforeEach -> - $("body").addClass("content") - @view = new CMS.Views.Course(el: $("#main-section")) - $(".cal").css(height: 100) - $("#main-section>section").css(minHeight: 100) - CMS.trigger("content.hide") - - afterEach -> - $("body").removeClass("content") - - it "remove content class from body", -> - expect($("body").attr("class")).toEqual("") - - it "remove content from .main-content", -> - expect($(".main-content")).toHaveHtml("") - - it "reset height on calendar", -> - expect($(".cal")).not.toHaveCss(height: "100px") - - it "reset minimum height on all sections", -> - expect($("#main-section>section")).not.toHaveCss(minHeight: "100px") - - describe "maxWeekHeight", -> - it "return maximum height of the week element", -> - @view = new CMS.Views.Course(el: $("#main-section")) - expect(@view.maxWeekHeight()).toEqual(101) - - describe "contentHeight", -> - beforeEach -> - $("body").append($('
').height(100).hide()) - - afterEach -> - $("body>header#test").remove() - - it "return the window height minus the header bar", -> - @view = new CMS.Views.Course(el: $("#main-section")) - expect(@view.contentHeight()).toEqual($(window).height() - 100) diff --git a/cms/static/coffee/spec/views/module_edit_spec.coffee b/cms/static/coffee/spec/views/module_edit_spec.coffee index 067d169bca..5e83ecb42d 100644 --- a/cms/static/coffee/spec/views/module_edit_spec.coffee +++ b/cms/static/coffee/spec/views/module_edit_spec.coffee @@ -1,81 +1,74 @@ describe "CMS.Views.ModuleEdit", -> beforeEach -> - @stubModule = jasmine.createSpyObj("Module", ["editUrl", "loadModule"]) - spyOn($.fn, "load") + @stubModule = jasmine.createSpy("CMS.Models.Module") + @stubModule.id = 'stub-id' + + setFixtures """ -
- save - cancel -
    -
  1. - submodule -
  2. -
+
  • +
    +
    + ${editor} +
    + Save + Cancel
    - """ #" +
    + Edit + Delete +
    + +
    +
    +
    +
  • + """ + spyOn($.fn, 'load').andReturn(@moduleData) + + @moduleEdit = new CMS.Views.ModuleEdit( + el: $(".component") + model: @stubModule + onDelete: jasmine.createSpy() + ) CMS.unbind() - describe "defaults", -> - it "set the correct tagName", -> - expect(new CMS.Views.ModuleEdit(model: @stubModule).tagName).toEqual("section") + describe "class definition", -> + it "sets the correct tagName", -> + expect(@moduleEdit.tagName).toEqual("li") - it "set the correct className", -> - expect(new CMS.Views.ModuleEdit(model: @stubModule).className).toEqual("edit-pane") + it "sets the correct className", -> + expect(@moduleEdit.className).toEqual("component") - describe "view creation", -> - beforeEach -> - @stubModule.editUrl.andReturn("/edit_item?id=stub_module") - new CMS.Views.ModuleEdit(el: $("#module-edit"), model: @stubModule) + describe "methods", -> + describe "initialize", -> + beforeEach -> + spyOn(CMS.Views.ModuleEdit.prototype, 'render') + @moduleEdit = new CMS.Views.ModuleEdit( + el: $(".component") + model: @stubModule + onDelete: jasmine.createSpy() + ) - it "load the edit via ajax and pass to the model", -> - expect($.fn.load).toHaveBeenCalledWith("/edit_item?id=stub_module", jasmine.any(Function)) - if $.fn.load.mostRecentCall - $.fn.load.mostRecentCall.args[1]() - expect(@stubModule.loadModule).toHaveBeenCalledWith($("#module-edit").get(0)) + it "renders the module editor", -> + expect(@moduleEdit.render).toHaveBeenCalled() - describe "save", -> - beforeEach -> - @stubJqXHR = jasmine.createSpy("stubJqXHR") - @stubJqXHR.success = jasmine.createSpy("stubJqXHR.success").andReturn(@stubJqXHR) - @stubJqXHR.error = jasmine.createSpy("stubJqXHR.error").andReturn(@stubJqXHR) - @stubModule.save = jasmine.createSpy("stubModule.save").andReturn(@stubJqXHR) - new CMS.Views.ModuleEdit(el: $(".module-edit"), model: @stubModule) - spyOn(window, "alert") - $(".save-update").click() + describe "render", -> + beforeEach -> + spyOn(@moduleEdit, 'loadDisplay') + spyOn(@moduleEdit, 'delegateEvents') + @moduleEdit.render() - it "call save on the model", -> - expect(@stubModule.save).toHaveBeenCalled() + it "loads the module preview and editor via ajax on the view element", -> + expect(@moduleEdit.$el.load).toHaveBeenCalledWith("/preview_component/#{@moduleEdit.model.id}", jasmine.any(Function)) + @moduleEdit.$el.load.mostRecentCall.args[1]() + expect(@moduleEdit.loadDisplay).toHaveBeenCalled() + expect(@moduleEdit.delegateEvents).toHaveBeenCalled() - it "alert user on success", -> - @stubJqXHR.success.mostRecentCall.args[0]() - expect(window.alert).toHaveBeenCalledWith("Your changes have been saved.") + describe "loadDisplay", -> + beforeEach -> + spyOn(XModule, 'loadModule') + @moduleEdit.loadDisplay() - it "alert user on error", -> - @stubJqXHR.error.mostRecentCall.args[0]() - expect(window.alert).toHaveBeenCalledWith("There was an error saving your changes. Please try again.") - - describe "cancel", -> - beforeEach -> - spyOn(CMS, "popView") - @view = new CMS.Views.ModuleEdit(el: $("#module-edit"), model: @stubModule) - $(".cancel").click() - - it "pop current view from viewStack", -> - expect(CMS.popView).toHaveBeenCalled() - - describe "editSubmodule", -> - beforeEach -> - @view = new CMS.Views.ModuleEdit(el: $("#module-edit"), model: @stubModule) - spyOn(CMS, "pushView") - spyOn(CMS.Views, "ModuleEdit") - .andReturn(@view = jasmine.createSpy("Views.ModuleEdit")) - spyOn(CMS.Models, "Module") - .andReturn(@model = jasmine.createSpy("Models.Module")) - $(".module-edit").click() - - it "push another module editing view into viewStack", -> - expect(CMS.pushView).toHaveBeenCalledWith @view - expect(CMS.Views.ModuleEdit).toHaveBeenCalledWith model: @model - expect(CMS.Models.Module).toHaveBeenCalledWith - id: "i4x://mitx/course/html/module" - type: "html" + it "loads the .xmodule-display inside the module editor", -> + expect(XModule.loadModule).toHaveBeenCalled() + expect(XModule.loadModule.mostRecentCall.args[0]).toBe($('.xmodule_display')) diff --git a/cms/static/coffee/spec/views/module_spec.coffee b/cms/static/coffee/spec/views/module_spec.coffee deleted file mode 100644 index 826263bc41..0000000000 --- a/cms/static/coffee/spec/views/module_spec.coffee +++ /dev/null @@ -1,24 +0,0 @@ -describe "CMS.Views.Module", -> - beforeEach -> - setFixtures """ -
    - edit -
    - """ - - describe "edit", -> - beforeEach -> - @view = new CMS.Views.Module(el: $("#module")) - spyOn(CMS, "replaceView") - spyOn(CMS.Views, "ModuleEdit") - .andReturn(@view = jasmine.createSpy("Views.ModuleEdit")) - spyOn(CMS.Models, "Module") - .andReturn(@model = jasmine.createSpy("Models.Module")) - $(".module-edit").click() - - it "replace the main view with ModuleEdit view", -> - expect(CMS.replaceView).toHaveBeenCalledWith @view - expect(CMS.Views.ModuleEdit).toHaveBeenCalledWith model: @model - expect(CMS.Models.Module).toHaveBeenCalledWith - id: "i4x://mitx/course/html/module" - type: "html" diff --git a/cms/static/coffee/spec/views/week_edit_spec.coffee b/cms/static/coffee/spec/views/week_edit_spec.coffee deleted file mode 100644 index 754474d77f..0000000000 --- a/cms/static/coffee/spec/views/week_edit_spec.coffee +++ /dev/null @@ -1,7 +0,0 @@ -describe "CMS.Views.WeekEdit", -> - describe "defaults", -> - it "set the correct tagName", -> - expect(new CMS.Views.WeekEdit().tagName).toEqual("section") - - it "set the correct className", -> - expect(new CMS.Views.WeekEdit().className).toEqual("edit-pane") diff --git a/cms/static/coffee/spec/views/week_spec.coffee b/cms/static/coffee/spec/views/week_spec.coffee deleted file mode 100644 index d5256b0a57..0000000000 --- a/cms/static/coffee/spec/views/week_spec.coffee +++ /dev/null @@ -1,67 +0,0 @@ -describe "CMS.Views.Week", -> - beforeEach -> - setFixtures """ -
    -
    - - edit -
      -
    • -
    • -
    -
    - """ - CMS.unbind() - - describe "render", -> - beforeEach -> - spyOn(CMS.Views, "Module").andReturn(jasmine.createSpyObj("Module", ["render"])) - $.fn.inlineEdit = jasmine.createSpy("$.fn.inlineEdit") - @view = new CMS.Views.Week(el: $("#week"), height: 100).render() - - it "set the height of the element", -> - expect(@view.el).toHaveCss(height: "100px") - - it "make .editable as inline editor", -> - expect($.fn.inlineEdit.calls[0].object.get(0)) - .toEqual($(".editable").get(0)) - - it "make .editable-test as inline editor", -> - expect($.fn.inlineEdit.calls[1].object.get(0)) - .toEqual($(".editable-textarea").get(0)) - - it "create module subview for each module", -> - expect(CMS.Views.Module.calls[0].args[0]) - .toEqual({ el: $("#module-one").get(0) }) - expect(CMS.Views.Module.calls[1].args[0]) - .toEqual({ el: $("#module-two").get(0) }) - - describe "edit", -> - beforeEach -> - new CMS.Views.Week(el: $("#week"), height: 100).render() - spyOn(CMS, "replaceView") - spyOn(CMS.Views, "WeekEdit") - .andReturn(@view = jasmine.createSpy("Views.WeekEdit")) - $(".week-edit").click() - - it "replace the content with edit week view", -> - expect(CMS.replaceView).toHaveBeenCalledWith @view - expect(CMS.Views.WeekEdit).toHaveBeenCalled() - - describe "on content.show", -> - beforeEach -> - @view = new CMS.Views.Week(el: $("#week"), height: 100).render() - @view.$el.height("") - @view.setHeight() - - it "set the correct height", -> - expect(@view.el).toHaveCss(height: "100px") - - describe "on content.hide", -> - beforeEach -> - @view = new CMS.Views.Week(el: $("#week"), height: 100).render() - @view.$el.height("100px") - @view.resetHeight() - - it "remove height from the element", -> - expect(@view.el).not.toHaveCss(height: "100px") diff --git a/cms/static/coffee/src/main.coffee b/cms/static/coffee/src/main.coffee index 57b6d1ae93..8c23d6ac99 100644 --- a/cms/static/coffee/src/main.coffee +++ b/cms/static/coffee/src/main.coffee @@ -6,28 +6,6 @@ AjaxPrefix.addAjaxPrefix(jQuery, -> CMS.prefix) prefix: $("meta[name='path_prefix']").attr('content') - viewStack: [] - - start: (el) -> - new CMS.Views.Course(el: el).render() - - replaceView: (view) -> - @viewStack = [view] - CMS.trigger('content.show', view) - - pushView: (view) -> - @viewStack.push(view) - CMS.trigger('content.show', view) - - popView: -> - @viewStack.pop() - if _.isEmpty(@viewStack) - CMS.trigger('content.hide') - else - view = _.last(@viewStack) - CMS.trigger('content.show', view) - view.delegateEvents() - _.extend CMS, Backbone.Events $ -> @@ -41,7 +19,3 @@ $ -> navigator.userAgent.match /iPhone|iPod|iPad/i $('body').addClass 'touch-based-device' if onTouchBasedDevice() - - - CMS.start($('section.main-container')) - diff --git a/cms/static/coffee/src/models/new_module.coffee b/cms/static/coffee/src/models/new_module.coffee deleted file mode 100644 index 58a109225e..0000000000 --- a/cms/static/coffee/src/models/new_module.coffee +++ /dev/null @@ -1,5 +0,0 @@ -class CMS.Models.NewModule extends Backbone.Model - url: '/clone_item' - - newUrl: -> - "/new_item?#{$.param(parent_location: @get('parent_location'))}" diff --git a/cms/static/coffee/src/views/course.coffee b/cms/static/coffee/src/views/course.coffee deleted file mode 100644 index 2a5a012c07..0000000000 --- a/cms/static/coffee/src/views/course.coffee +++ /dev/null @@ -1,28 +0,0 @@ -class CMS.Views.Course extends Backbone.View - initialize: -> - CMS.on('content.show', @showContent) - CMS.on('content.hide', @hideContent) - - render: -> - @$('#weeks > li').each (index, week) => - new CMS.Views.Week(el: week, height: @maxWeekHeight()).render() - return @ - - showContent: (subview) => - $('body').addClass('content') - @$('.main-content').html(subview.render().el) - @$('.cal').css height: @contentHeight() - @$('>section').css minHeight: @contentHeight() - - hideContent: => - $('body').removeClass('content') - @$('.main-content').empty() - @$('.cal').css height: '' - @$('>section').css minHeight: '' - - maxWeekHeight: -> - weekElementBorderSize = 1 - _.max($('#weeks > li').map -> $(this).height()) + weekElementBorderSize - - contentHeight: -> - $(window).height() - $('body>header').outerHeight() diff --git a/cms/static/coffee/src/views/module.coffee b/cms/static/coffee/src/views/module.coffee deleted file mode 100644 index 1b9e39e8c2..0000000000 --- a/cms/static/coffee/src/views/module.coffee +++ /dev/null @@ -1,14 +0,0 @@ -class CMS.Views.Module extends Backbone.View - events: - "click .module-edit": "edit" - - edit: (event) => - event.preventDefault() - previewType = @$el.data('preview-type') - moduleType = @$el.data('type') - CMS.replaceView new CMS.Views.ModuleEdit - model: new CMS.Models.Module - id: @$el.data('id') - type: if moduleType == 'None' then null else moduleType - previewType: if previewType == 'None' then null else previewType - diff --git a/cms/static/coffee/src/views/module_add.coffee b/cms/static/coffee/src/views/module_add.coffee deleted file mode 100644 index f379174c77..0000000000 --- a/cms/static/coffee/src/views/module_add.coffee +++ /dev/null @@ -1,26 +0,0 @@ -class CMS.Views.ModuleAdd extends Backbone.View - tagName: 'section' - className: 'add-pane' - - events: - 'click .cancel': 'cancel' - 'click .save': 'save' - - initialize: -> - @$el.load @model.newUrl() - - save: (event) -> - event.preventDefault() - @model.save({ - name: @$el.find('.name').val() - template: $(event.target).data('template-id') - }, { - success: -> CMS.popView() - error: -> alert('Create failed') - }) - - cancel: (event) -> - event.preventDefault() - CMS.popView() - - diff --git a/cms/static/coffee/src/views/week.coffee b/cms/static/coffee/src/views/week.coffee deleted file mode 100644 index e2b5a50d59..0000000000 --- a/cms/static/coffee/src/views/week.coffee +++ /dev/null @@ -1,32 +0,0 @@ -class CMS.Views.Week extends Backbone.View - events: - 'click .week-edit': 'edit' - 'click .new-module': 'new' - - initialize: -> - CMS.on('content.show', @resetHeight) - CMS.on('content.hide', @setHeight) - - render: -> - @setHeight() - @$('.editable').inlineEdit() - @$('.editable-textarea').inlineEdit(control: 'textarea') - @$('.modules .module').each -> - new CMS.Views.Module(el: this).render() - return @ - - edit: (event) -> - event.preventDefault() - CMS.replaceView(new CMS.Views.WeekEdit()) - - setHeight: => - @$el.height(@options.height) - - resetHeight: => - @$el.height('') - - new: (event) => - event.preventDefault() - CMS.replaceView new CMS.Views.ModuleAdd - model: new CMS.Models.NewModule - parent_location: @$el.data('id') diff --git a/cms/static/coffee/src/views/week_edit.coffee b/cms/static/coffee/src/views/week_edit.coffee deleted file mode 100644 index 3082bc9fe2..0000000000 --- a/cms/static/coffee/src/views/week_edit.coffee +++ /dev/null @@ -1,3 +0,0 @@ -class CMS.Views.WeekEdit extends Backbone.View - tagName: 'section' - className: 'edit-pane' diff --git a/lms/envs/jasmine.py b/lms/envs/jasmine.py index 14c504e34f..317628f8ba 100644 --- a/lms/envs/jasmine.py +++ b/lms/envs/jasmine.py @@ -17,8 +17,9 @@ LOGGING = get_logger_config(TEST_ROOT / "log", PIPELINE_JS['js-test-source'] = { 'source_filenames': sum([ pipeline_group['source_filenames'] - for pipeline_group - in PIPELINE_JS.values() + for group_name, pipeline_group + in PIPELINE_JS.items() + if group_name != 'spec' ], []), 'output_filename': 'js/lms-test-source.js' } diff --git a/rakefile b/rakefile index 798898310e..3eb3b7e224 100644 --- a/rakefile +++ b/rakefile @@ -49,7 +49,6 @@ def django_for_jasmine(system, django_reload) django_pid = fork do exec(*django_admin(system, 'jasmine', 'runserver', "12345", reload_arg).split(' ')) end - puts django_pid jasmine_url = 'http://localhost:12345/_jasmine/' up = false start_time = Time.now