Commit Graph

52 Commits

Author SHA1 Message Date
Ahmad Amireh 83e4f6d4ab extract date-time-moment-parser
refs FOO-1891

this is the start of a series to break apart the inter-dependencies
between timezone and moment.js

the formatting that is done by moment now stands alone in
packages/date-time-moment-parser and is used by ui/shared/timezone. The
formatter depends on phrases coming from the locale files, which are
available to ui/* but not to packages/*, so in an initializer we inject
our custom formats into the package, allowing it to make use of them.

there should be no breaking API changes, even though several APIs were
dropped, as they were all used in test but not in the app code. To
minimize the changes, a specHelpers.js file is now provided by the
timezone package that maintains backwards compat to a reasonable extent.

TEST PLAN
==== ====

although the tests should be covering this, it wouldn't hurt to manually
exercise any of the date picker widgets

Change-Id: I0c59ad2df8f7392425debb6ec448ec1b4fb029c6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265313
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
2021-08-05 21:53:25 +00:00
Ahmad Amireh 4243097b21 rename some things
fixes FOO-1265

[skip-eslint=true]
[pin-commit-analytics=7e49eefd7f59cbf43fd03bf8957bbbfa76f8d9d5]
[pin-commit-demo_site=adade2e38e46a358a4643cd3db2fe5ccffe39ec5]
[pin-commit-instructure_misc_plugin=47a3161102b0611af56d134fbd0c828ddc1b8abf]
[pin-commit-migration_tool=0dbac2f5b421d894395605ce4b583ef0f7d60b22]
[pin-commit-multiple_root_accounts=cc96d28c0d59bbe47acc64de4fdd8e1d2b029805]

Change-Id: I14c07f20bd260cf0de1f48ceb70b3c2313edf2d2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258807
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-04-06 01:12:49 +00:00
Drake Harper 14efb60bb6 Handle planner notes api call in AgendaViewSpec
fixes VICE-639
flag=none

In the removal of the student planner feature flag
This check was added to keep tests from failing and
should be removed

test plan:
  - specs should pass

qa risk: low

Change-Id: I9de70183296f811d81fbf3814f82f6e8fd17f41e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243367
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jeffrey Johnson <jeffrey.johnson@instructure.com>
Reviewed-by: Jeffrey Johnson <jeffrey.johnson@instructure.com>
QA-Review: Jeffrey Johnson <jeffrey.johnson@instructure.com>
Product-Review: Jeffrey Johnson <jeffrey.johnson@instructure.com>
2020-07-31 16:19:38 +00:00
Ed Schiebel 2e3ee0bc82 Wait for tinyrce to initialize itself before accessing the editor
closes LA-620
flag=la_620_old_rce_init_fix

test plan:
  - Turn off rce_enhancements
  - Create an assignment and edit in some desciption
  - Save
  - Edit
    - if you are recreating the original issue, loading
      the edit page will cause a js error, the sidebar
      will not load and you will not be able to save
      the assignemnt. Ideally, you can reproduce this
      before moving on.
  - turn on the la_620_old_rce_init_fix flag
  - repeatedly refresh the assignment's edit page
  > expect no js error and the sidebar loads every time

Change-Id: Ie0217e4aba1b61a3cd5986e35da7aa62ea1297b6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228299
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Clint Furse <cfurse@instructure.com>
2020-03-04 20:30:59 +00:00
Clay Diffrient 9b08b0b3e1 spec: Run prettier on spec/coffeescripts
This also adds things in this directory to the whitelist
to make sure nothing ugly gets introduced.

Test Plan:
  - Automated tests pass
  - Make a non-pretty change in a js file within spec/coffeescripts
  - Commit it
  - Notice it has been prettierfied

refs COREFE-347

flag = none

Change-Id: I52a32b5888da2ad8fc8054f753bc75e48b5ab843
Reviewed-on: https://gerrit.instructure.com/212515
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-10-10 19:33:55 +00:00
Ryan Shaw 78a25bf4e8 [codemod] convert functions to fat arrows
This is the result of running:

jscodeshift -t ../js-codemod/transforms/arrow-function.js .

see: https://github.com/cpojer/js-codemod#arrow-function

Transforms callbacks only when it can guarantee it won't break this 
context in the function. 
Also transforms function() { }.bind(this) calls to () => {}.

jscodeshift -t js-codemod/transforms/arrow-function.js <file>


Change-Id: I04d20c818002b3dce5a43d8e91f01d904f966706
Reviewed-on: https://gerrit.instructure.com/205785
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-08-26 22:20:33 +00:00
Ryan Shaw 4f97c6df56 remove all the legacy RCE code
closes: CORE-2588 CORE-2591

This completely removes the legacy RCE codepath. So you will need to
Have an https://github.com/instructure/canvas-rce-api running to use
sidebar in any Rich Content Editors.

Test plan:
* smoke test to make sure that the editor and sidebar work as it did
  When you had the RCS feature flag on.
* there should not be any more settings or feature flags around turning
  on the RCS service

Change-Id: I1c3e7f5a45eed5e010d8e425ae561e45f739fd3a
Reviewed-on: https://gerrit.instructure.com/186525
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
2019-04-04 18:19:12 +00:00
Jeremy Neander fc3be4d5b5 spec: [ci-coverage] prevent global spec failures
This should ensure that global window errors are caught and reported,
but will allow the entire spec suite to continue. If a test is currently
in the queue, it will be failed. If no test is currently in the queue, a
failing test will be pushed onto the queue.

Change-Id: I7c0f032ac42f68b7cb359d105fe14df208c6bd3c
Reviewed-on: https://gerrit.instructure.com/187559
Tested-by: Jenkins
Reviewed-by: Keith Garner <kgarner@instructure.com>
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-03-30 15:52:44 +00:00
Ryan Shaw 52437a1137 Fix some invalid imports
These are all things that were improperly importing either:
* a “default” object when there was only named exports
* a named export when there is only a default export

They work now because we tell babel to transpile es modules down
to commonJS in the “env” preset in babelrc but we want to eventually
not do that and these will need to be fixed before then

Test plan:
* no functionality should actually change in the code generated by
  Webpack
* this build should pass
* but so should the build for the commit that follows this that
  sets the `“modules”: false` option for babel-preset-env in
  .babelrc

Change-Id: Ic6f49fb94ee0d0592ca5e34ef7ed0a5633c40d80
Reviewed-on: https://gerrit.instructure.com/167054
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2018-10-09 21:31:57 +00:00
Ryan Shaw 1d5a3683e5 spec: convert createClass to es6 classes in /spec
npx jscodeshift -t ../react-codemod/transforms/class.js spec

Change-Id: I07f29d8e1fd319ea6b3f38a36c938e3d160bcba5
Reviewed-on: https://gerrit.instructure.com/163915
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-09-11 15:47:26 +00:00
Derek Bender 0434bcab47 spec: delete unused ajax_mocks
Change-Id: I988543d35be1d556cedbd8abae8e3f5b8ff7c6ad
Reviewed-on: https://gerrit.instructure.com/154287
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
Product-Review: Derek Bender <djbender@instructure.com>
QA-Review: Derek Bender <djbender@instructure.com>
2018-06-19 12:59:58 +00:00
decaffeinate f5e4bc2d80 [spec][decaffeinate] convert coffe specs to js syntax
...and pass them through amdtoes6, eslint, and prettier

This converts most of our coffeescript spec files to javscript, to
es module syntax and applies our eslint code formatting rules to it.

Because this is just spec files, as long as the tests still run
and they all still pass, this should be good. That makes these a lot
easier and safer to deal with converting than the stuff in
app/coffeescripts

After this commit there should not be any .coffee files in the
/spec/ directory.

test plan:
* jenkins should run the same # of js specs as before and they should
  all pass

Change-Id: I701c101777486e2e37d0ec1327692f16099352cd
Reviewed-on: https://gerrit.instructure.com/141556
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-02-22 16:45:17 +00:00
decaffeinate c08c698d05 [spec][decaffeinate] rename coffe specs from .coffee to .js
this will not pass jenkins since it renames these files to .js
without also converting the syntax to javaScript. However, this is
intentionally it's own commit so that when you `git log --follow`
a file, it can track its history across the name change.

the following commit actually changes the syntax.

test plan:
* make sure the next commit passes. This should just rename things

Change-Id: I4b56f2789eda12cba64a3716462fecce31b2e895
Reviewed-on: https://gerrit.instructure.com/141555
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Simon Williams <simon@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Tested-by: Ryan Shaw <ryan@instructure.com>
2018-02-22 16:45:05 +00:00
Ryan Shaw d8259be7cc speed up JS tests by running them concurrently
closes: CORE-865

In order to get accurate coverage reports (ie: so the coverage numbers 
don’t only reflect a fraction of the total tests), when the COVERAGE 
environment variable is set, it does not split them out into groups to
run concurrently. That way our linters-and-js-master build (which sets
that environment variable) will run the same as it always has and our 
patch-set builds (which run the linters-and-js) will be faster.

Test plan:
* run ‘yarn test’
* it should be a lot faster than it used to be

* look at the linters-and-js build in jenkins for this commit
* it should have test reports for all both groups (coffee, js)
  Of karma tests as well as for the jest tests.

* look at the coverage report after this gets merged. It should be
  the same as it was before

Change-Id: I35147cc84df4afae92c1a73c201667d4d44b5518
Reviewed-on: https://gerrit.instructure.com/136373
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-01-16 19:32:28 +00:00
Derek Bender b4d85c7ddb hide student names from details dialog in gb
fixes: GRADE-363

test plan:
- Given old gradebook
- Given "Hide Student Names" enabled
- When opening the submission details dialog via the comments button for
a submission
- Then the student's name is not present
- Then any comments that aren't the teacher's are hidden

Change-Id: I662f20e9bd4479657b0e8b9f15ac3c8a1e66ef5c
Reviewed-on: https://gerrit.instructure.com/131633
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2017-11-03 20:55:05 +00:00
Matthew Berns 3c91cd73cf add aXe testing to assignment views
also correct ignore rules from html-lang to html-has-lang

test plan:
- run the spec files edited in this patch normally with
  yarn run jspec-watch path/to/spec
- tests should all pass as expected
- run the spec files edited in this patch with the new command
  yarn run a11y-report path/to/spec
- you should get aXe errors on existing a11y violations

Change-Id: I239d81fbfcfc8cdbec89d88e5966308de3b6aae7
Reviewed-on: https://gerrit.instructure.com/130892
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
Product-Review: Matt Berns <mberns@instructure.com>
QA-Review: Matt Berns <mberns@instructure.com>
2017-10-30 17:04:56 +00:00
Matthew Berns 23e41db772 spec: add aXe unit testing capability
this patch updates the a11y helper, adds a new spec
script to run, and adds aXe testing to discussion views

test plan:
- run the spec files edited in this patch normally with
  yarn run jspec-watch path/to/spec
- tests should all pass as expected
- run the spec files edited in this patch with the new command
  yarn run a11y-report path/to/spec
- you should get aXe errors on existing a11y violations

Change-Id: Ib3db892046e115bedb363752d1e56226eef893af
Reviewed-on: https://gerrit.instructure.com/87962
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
Product-Review: Matt Berns <mberns@instructure.com>
QA-Review: Matt Berns <mberns@instructure.com>
2017-10-25 16:44:56 +00:00
Jennifer Stern 29ce91643a Upgrade React, instructure-ui and instructure-icons
fixes CNVS-36648, closes INSTUI-421

Test plan:

The following areas of Canvas are affected by this upgrade:
- High contrast mode and theme editor branding
- blueprint courses
- conditional release stats
- student context cards
- new user tutorial
- course home dialog

Change-Id: I5d7128e4ebf88a34342ffcb99d4ccf7dd839b2f7
Reviewed-on: https://gerrit.instructure.com/111443
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Jennifer Stern <jstern@instructure.com>
QA-Review: Dan Sasaki <dsasaki@instructure.com>
Tested-by: Jenkins
2017-05-16 21:15:44 +00:00
Landon Wilkins 2f26c46311 da licença part 43
add consistent license headers to all source files

Change-Id: Ief50339aedf02bb206dcc2ccba1716353702a8a9
Reviewed-on: https://gerrit.instructure.com/110148
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-28 17:48:54 +00:00
Ryan Shaw 14b9f2df14 ‘require’ axe from node_modules
Change-Id: I472dda47c01502785a4988aa8c6198e030832d36
Reviewed-on: https://gerrit.instructure.com/102168
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2017-02-17 19:06:50 +00:00
Jon Jensen 3f36c05513 fix locale fallbacks in JS land, fixes CNVS-29506, refs SD-71
in JS land, if a locale doesn't provide all strings, ensure we fall back
to its ancestor locales (if any) before we try `en`. this already works
correctly in ruby land.

also don't dump empty locales, since this hasn't been necessary since
cd8cd591ac

test plan:
1. run canvas without RAILS_LOAD_ALL_LOCALES or USE_OPTIMIZED_JS
2. switch to spanish
3. you should see english everywhere and not get js errors or missing
   translation messages
4. run canvas with RAILS_LOAD_ALL_LOCALES and USE_OPTIMIZED_JS
5. you should see spanish
6. ensure you have a custom en-GB-* locale per CNVS-29506
7. switch to that locale
8. ensure you see its strings, and en-GB where it doesn't specify any,
   e.g. "colour" in the Theme Editor instead of "color"

Change-Id: I349ef79ca3bb300a83cd45a11cf3b7ffd0fc2cf9
Reviewed-on: https://gerrit.instructure.com/80094
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
2016-05-20 20:56:19 +00:00
Jacob Fugal 79861cf20d clean up RCE abstraction layer and service sidebar
refs CNVS-26704, CNVS-26707

RichContentEditor and RceCommandShim:

* move risk level management all to the server side; just one flag in JS
  is set contextually in the server response based on server chosen risk
  level for the page

* flatten the RichContentEditor and RceCommandShim modules to singleton
  method collections, rather than instances

* add RceCommandShim.focus and .destroy methods that more gracefully
  divide the implementations vs. just using send(target, 'focus') or
  send(target, 'destroy')

Editor Loading and Focus

* replace attachSidebarTo calls -- which always (see one exception
  below) paired with a loadNewEditor call -- are replaced with the
  focus:true option to loadNewEditor. when on, the editor is explicitly
  focused after load; it no longer turns on tinymce auto_focus

* on internal tinymce events that trigger 'editor_box_focus' events,
  explicitly focus the editor. this was an attachSidebarTo call (the
  exception) only registered for quizzes, but now more generally.

Editor Destruction

* replace callOnRCE(target, 'destroy') and target._removeEditor() calls
  with new RichContentEditor.destroyRCE(target). destroys the editor as
  before, but does so through new RceCommandShim.destroy and also hides
  sidebar (so no need for explicit hideSidebar calls, which only ever
  accompanied editor destruction)

Sidebar

* add remoteSidebar.show() and remoteSidebar.hide() polyfills

* separate sidebar abstraction into Sidebar module. public interface is
  still through RichContentEditor: initSidebar calls Sidebar.init and
  show/hide are only called from RichContentEditor implementation in
  response to editor focus and destruction.

* allow registering callbacks during initSidebar for when the sidebar is
  shown/hidden. so the desired action doesn't have to be coupled with
  individual calls to loadNewEditor and destroyRCE.

* ensure initSidebar, when present, precedes loadNewEditor. so if
  there's going to be a sidebar, it's initialized before the editor load
  tries to show it.

* add initSidebar calls to discussions/Reply.coffee and
  editor/EditorToggle.coffee so that they get automatic focus, sidebar
  show on editor load, and sidebar hide on editor destruction,
  previously provided by util/wikiSidebarWithMultipleEditors.coffee.

* cache wikiSidebar elements as soon as initSidebar is called, rather
  than waiting for domready, so that initSidebar doesn't have to be in a
  domready itself.

Miscellaneous

* replace calls of target._justGetCode() and target._setContentCode(...)
  with RichContentEditor.callOnRCE(target, 'get_code') and
  RichContentEditor.callonRCE(target, 'set_code', ...), respectively

* remove a dead legacy bundle and d dead module only used by that dead
  bundle

* clean up dependencies to remove unnecessary references to wikiSidebar,
  compiled/tinymce, and tinymce.editor_box outside of the abstraction
  layer or legacy-only code.

* fix idGenerator fragile spec bug

test-plan:
  there should not be significant changes in _what_ the RCE or sidebar
  does. but significant changes in _how_. so no new features to test,
  but a thorough regression on RCE and sidebar behaviors is probably in
  order (sorry)

Change-Id: I4e0cbcb3dcb28152750bf9267d795a179822a601
Reviewed-on: https://gerrit.instructure.com/75469
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2016-03-30 18:03:24 +00:00
Jacob Fugal efc0cfc2ad RCEStore.callOnTarget
refs CNVS-26704, CNVS-26707

 * renamed for clarity
 * implementation cleaned up and simplified (esp. regarding only
   recieving one node)
 * absorbed `!$target.data('rich_text')` handling from RceCommandShim
 * related test methods reworked to use fixtures and spies rather than
   fake objects / modules
 * introduces `helpers/fixtures` for specs
 * removes unnecessary parameters to RichContentEditor and
   RceCommandShim

test-plan: smoke test RCE with service enabled

Change-Id: Idf9ec89e21243102eb137a0e63819999db0d7d93
Reviewed-on: https://gerrit.instructure.com/74305
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2016-03-22 00:04:39 +00:00
Alex Boyd f3b32bbd81 Make friendlyDatetime screenreader accessible
Fixes CNVS-26456

Test plan:
 - Make sure the full date and time are read by screenreaders for
   conversation messages per the ticket
 - Make sure all places where friendlyDatetime is used still
   behave as expected

Change-Id: I335249e84414c9a20613ec6a8bd473ced4ab3eec
Reviewed-on: https://gerrit.instructure.com/70742
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins
QA-Review: Pierce Arner <pierce@instructure.com>
Product-Review: Alex Boyd <aboyd@instructure.com>
2016-03-18 18:06:43 +00:00
Ethan Vizitei 7cf97d0709 handle multiple RCE requests
fixes CNVS-27951

also document which methods are not in the
public interface to be clear
which methods are ok for other modules to call
on the service loader

TEST PLAN:
 1) go to some RCE use case with the service
    enabled
 2) make sure only 1 "get_module" call happens
    in the network panel

Change-Id: I064436e2a9ea7aa1c340848a2bf3e91dfcd23bb5
Reviewed-on: https://gerrit.instructure.com/74292
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2016-03-15 23:11:53 +00:00
Jennifer Stern 337a882536 Add automated a11y testing helper for qunit tests
refs SD-743
fixes CNVS-26721

This adds a qunit assertion helper that wraps the aXe library. Rules can
be ignored by passing an array of rules in the options argument to the
helper.

e.g.
`assertions.isAccessible $html, done, { ignores: 'aria-valid-attr-value'}`

Test plan:

Undo the changes that I made to the DashboardCard.jsx component.
You should get a warning about invalid aria attributes because the
aria-controls attribute is referring to an element that doesn't exist.

To fix this, I modified the component to hide/show the color picker so that
the aria attribute value is valid.

If you add the ignores option as described above, the test should pass
without my changes.

To verify the dashboard card color picker changes:

- Verify that you can click or use the ENTER key on a dashboard card
cog button to bring up the color picker
- Verify that you can select a color and apply it to the card.
- Verify that you can click outside the color picker to close it
- Verify that you can hit the ESC key to close the color picker
- When the color picker is closed, focus should return to the the cog
button trigger
- After selecting a color you should be able to open the color picker again
and select a different color

The color picker in the Calendar should be regression tested as well.

Change-Id: I5d5bfdaf39df1e0cb8776144771baeb1ed31ff2a
Reviewed-on: https://gerrit.instructure.com/70638
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Tested-by: Jenkins
2016-02-02 17:39:11 +00:00
Clay Diffrient 991548b93d Update Files to React 0.13.3
This also fixes the color picker on the calendar page

closes CNVS-24618

Test Plan:
  - Make sure files works as intended
  - There should be no errors warnings in the console related to
    React.
  - NOTE: There will be some really big warnings in Files because of
          React Router.  It will say something about parent context vs
          owner context.  Don't worry about this for now.

Change-Id: I62225f30174044c7114b79adc1e2d7541e60d17e
Reviewed-on: https://gerrit.instructure.com/66020
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2015-11-19 00:35:45 +00:00
Jeremy Stanley f566717b58 Revert "disable SRGB's assignment editing for past grading periods"
This reverts commit c428f832f2.

Change-Id: Icf3fe526b3656fea90fa06e38c62cf3ec7df14e4
Reviewed-on: https://gerrit.instructure.com/65273
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2015-10-16 21:24:36 +00:00
Strand McCutchen c428f832f2 disable SRGB's assignment editing for past grading periods
Fixes CNVS-22398

Test Plan:

1. As an admin, create an account-level grading period
    which ends in the past.
2. Create an assignment that is due within that grading
    period.
3. As a teacher, go to Gradebook, click on the grades for
    that assignment.
4. Observe that they are not editable.
5. Navigate to Individual View. Select the past grading
    period.
6. Select the assignment and a student in the Content
    Selection section.
7. Verify that you are unable to edit this grade.
8. Click "Submission Details."
9. Verify that you are unable to edit this grade.

Change-Id: Ide8194c8c3e0153a537908dce39330c79593cbdb
Reviewed-on: https://gerrit.instructure.com/63823
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Christi Wruck
2015-10-15 20:59:15 +00:00
Ethan Vizitei 20e2371c1c Unfragile JS specs
Sometimes on re-run, this spec doesn't have vendor/date loaded properly,
and because there are dependencies on the global behavior that
file adds, they fail intermittantly depending on whether
they've been required ahead of time.  Explicitly adding the requirement
seems to stabilize that failure.

Also we depend upon the require run to bind element_toggler to document.
because other places can strip off events, and the require doesn't run
everytime, I'm giving it a hook so you can explicitly bind up again
at any point with the "bind" method.

Also, I18n stubbing was in some way not getting a frame
popped, and that caused translation failures in some
cases.  Adding a "clear" method to clear out
stubbing in teardown to make sure there are no
artifacts.

Change-Id: I715f4f326e6796d583501ec7df24de5fc04b24e8
Reviewed-on: https://gerrit.instructure.com/54830
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Ethan Vizitei <evizitei@instructure.com>
2015-05-21 22:39:51 +00:00
Ethan Vizitei 96655903e3 stop using the body for DOM manipulation
this causes all our tests to do their dom manipulatio
inside the fixtures element, and makes sure to wipe the fixtures
element clean whenever it gets used.  This prevents DOM changes from
leaking between tests, much like database cleaner in ruby

Change-Id: I84f360609214557af6911ed6722928286d81a1ca
Reviewed-on: https://gerrit.instructure.com/52361
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Tested-by: Jenkins
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-04-16 19:30:43 +00:00
Ethan Vizitei 725a4c9b2f remove an unused spec helper
No test uses this "toString" function and when other processes
call toString implicitly (like in a regex comparison or similar) this
can override the expected behavior, producing errors for
elements that don't have the expected configuration.  These errors
fail js tests intermittantly, contributing to the fragility of the
aux build

removing it cuts down on spurious javascript failures.

Change-Id: I5b1eb12ecc7d1b849282f5011dbad89142208bf4
Reviewed-on: https://gerrit.instructure.com/52320
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Jenkins
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2015-04-16 03:17:36 +00:00
Jacob Fugal 2c7a691bf0 teach tz.format to recognize localization keys
refs CNVS-19516

so you can say e.g. tz.format(date, 'time.formats.tiny') and it will
choose the appropriate format string based on the locale.

at the same time, use localized format string (using this new
functionality) for $.dateString (and by extensions, datetimeString)
instead of hard-coded english-style format strings.

finally, refactor out I18nStubber javascript spec helper for testing
this.

test-plan:
 - change you profile locale to french
 - view a time formatted by $.datetimeString in the UI, e.g.
   due dates in a course's assignments page
 - should show with "<day> <month> <year> à <24-hour time>" rather than
   using "<month> <day>, <year>" and/or "<12-hour time with am/pm>"

Change-Id: Ic7779917d7af5e0fe9d4ef3cd99e6f12cf141c3c
Reviewed-on: https://gerrit.instructure.com/51447
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2015-04-07 17:19:09 +00:00
Dan Minkevitch 21b738177b Updated React for New Files
fixes CNVS-17166
closes CNVS-17944
closes CNVS-17945
refs CNVS-17946
fixes CNVS-18230
closes CNVS-18162

Upgrades New Files (used by the Better File
Browsing feature flag) to the latest versions
of React, react-router, and react-modal.

Test Plan:
* Enable "Better File Browsing" feature flag
* Full regression test to make sure that no
  previous functionality was broken

Change-Id: I5e5029b361f51cfad445cf696027e9482e8a04a9
Reviewed-on: https://gerrit.instructure.com/49577
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2015-03-13 16:34:11 +00:00
Simon Williams 5c44670db2 discussion reply tinymce keyboard shortcut icon renders correctly
fixes CNVS-18665

test plan:
- create a discussion, with a reply
- click on two different reply lines, so that two instances of tinymce
  open up
- each one should have their own keyboard shortcuts icon (the 'i' in
  a blue bubble)
- basic regression test of discussion replies

Change-Id: I855cea72caf56f250f2334da10bebd4c8a881bdf
Reviewed-on: https://gerrit.instructure.com/49250
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Aaron Cannon <acannon@instructure.com>
2015-02-25 23:16:24 +00:00
John Corrigan ccb3db7f1c address a number of issues with the js test suite
This patch handles a couple of things:

- `require` calls should not be used at the start of test files,
but they were. This switches them to `define`.
- There were a handful of tests that were not fulfilling initialized
promises, which led to the test suite hanging.
- There was a failure that popped up sometimes because `helpDialog`
was not cleaning up after itself. This adds a protection to
make sure that the instance is initialized before it is used.

Change-Id: Ie57f5ee6d45216f0d4071d34cc476201c3b7c9f6
Reviewed-on: https://gerrit.instructure.com/48447
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-02-20 16:35:17 +00:00
Mark Severson d7bd9ced1d explicitly require jquery in coffeescript modules
test plan:
 - no javascript-based pages break :\

Change-Id: I00f4bcaa5e6d239d274eeee4245a19606dfe651f
Reviewed-on: https://gerrit.instructure.com/30460
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Mark Severson <markse@instructure.com>
2014-02-21 23:44:52 +00:00
Aaron Shafovaloff fa189a98cd clean up JS tests and integrate karma
- js:generate_runner now generates common files to be used by different test runners
- js spec file order now shuffled to better expose dependencies
- fakeENV now returns two methods: setup and teardown
- stock tinymce 3 files are now wrapped for AMD

test plan:

- tinymce should work the same
- js:test rake task should run tests
- js:build task should work as normal (using new location of r.js)
- test results should successfully send to firework

Change-Id: Ic09647f55dae57130fa0fe3d6a9168d2b67b89a2
Reviewed-on: https://gerrit.instructure.com/29297
QA-Review: Shawn Meredith <shawn@instructure.com>
Tested-by: Shawn Meredith <shawn@instructure.com>
Tested-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
2014-02-07 19:40:37 +00:00
Braden Anderson 952cbefb75 lodash
fixes CNVS-10326

test plan:
  * require(['underscore'], function(_) {console.log(_.name)})
  * test canvas

Change-Id: If0b0e1e26f5344492250603dc4f863d138c28832
Reviewed-on: https://gerrit.instructure.com/28174
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-01-14 23:37:26 +00:00
Ryan Florence daa8134f55 one handlebars to rule them all
closes CNVS-9983, CNVS-9984, CNVS-9997, CNVS-10009

- using bower for handlebars and ember
- using bower for old handlebars precompilation
- using bower for ember precompilation

other notes:

- we don't use `Template` anymore, removed tests
- handlebars never intended for us to be able to
  drop ENV as a global handlebars variable, so
  we just explicitly throw it into the locals for
  each template.
  (https://github.com/wycats/handlebars.js/issues/565)
  

Change-Id: I954d6a2d944dd426fc923fe422020b26174811dc
Reviewed-on: https://gerrit.instructure.com/27497
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
Product-Review: Ryan Florence <ryanf@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
2013-12-18 16:55:19 +00:00
Simon Williams c3901aa3c3 spec: clean up javascript specs
* vddDueColumnView was never used
* window's beforeunload wouldn't trigger the second time for me
  (both chrome and phantomjs)
* be nicer about retrying specs when run with a custom matcher
* some specs need ENV.PERMISSIONS to exist
* no more vddDueTooltipView
* don't completely overwrite ENV in your spec ಠ_ಠ
* don't start tests before specs are loaded, but don't use
  QUnit.stop() before QUnit has loaded.  instead, don't let it autostart,
  and wait to call QUnit.start() until both are loaded.

Change-Id: Ib89cc9f2bd2c27a04f72e8dc1261953a7a640a46
Reviewed-on: https://gerrit.instructure.com/24795
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2013-10-29 14:55:11 +00:00
Jon Willesen 22fcb45b3d fix sorting on agenda view
the results of the events and assignments api request were not
being properly merged into a sorted list.

fixes CNVS-9037

test plan:
 - create a bunch of days that contain only events.
 - interleave a bunch of days that contain only assignments.
 - verify that the agenda view is sorted correctly.
 - verify that "load more" works properly.

Change-Id: I7f5c203149bb854496e64af053170b50361b7a96
Reviewed-on: https://gerrit.instructure.com/25641
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-10-28 21:10:44 +00:00
Zach Pendleton 99dbc71ece add calendar2 agenda view
fixes CNVS-8665

test plan:
  * from a console, run the following:

      account = Account.default
      account.settings[:agenda_view] = true
      account.save!

  * as any user, navigate to calendar2 and verify
    that an "agenda" button is visible in the header
    navigation;
  * verify that clicking the "agenda" button loads an
    agenda view and defaults to the current day;
  * verify that the calendar title is the current date;
  * verify that you can click back to month and week
    views and that they load as expected;
  * verify that if you click into agenda view while you
    are looking at a month or week that is not the current
    month/week, the agenda view date header reads as the
    first day of the month/week;
  * verify that if you have more than 50 events, the agenda
    view displays a "Load More" button at the bottom that
    will, when clicked, load additional events.

Change-Id: Ie365474ad166d247152ce9448b2b5a15ffc79425
Reviewed-on: https://gerrit.instructure.com/25102
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2013-10-15 19:29:11 +00:00
Mark Severson 3603934770 change api pagination to include the current page link
test plan:
 * exercise paginated api endpoints (including the search endpoint)
 - ensure the link headers now include current (for the current page)

refs CNVS-7508

Change-Id: Id271c3a05b726de9ce619bd0100af84db199d4f1
Reviewed-on: https://gerrit.instructure.com/23365
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-08-16 19:13:25 +00:00
Ryan Florence b18af81c24 add users from courses/:id/users page
test plan:
1. go to /courses/:id/users
2. click 'add users'
3. should work much like the add users UI in
   the course settings -> users tab, but look
   a little different

Change-Id: Icec24a41385e595d8b79dc5a7232545f0aff926e
Reviewed-on: https://gerrit.instructure.com/18888
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
Product-Review: Ryan Florence <ryanf@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
2013-04-18 19:43:54 +00:00
Ryan Florence 824e9d2c76 added PaginatedCollectionView
test plan:

1. see the specs, there is no implementation yet

Change-Id: I277300a507581cba4fe24682cad2d1ebbdf4147f
Reviewed-on: https://gerrit.instructure.com/18361
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
2013-03-08 10:35:25 -07:00
Ryan Florence 18c828f20d added some helpers to QUnit
Change-Id: I71d94f50fe9c30fb561a4ddc14cced5fe4f20126
Reviewed-on: https://gerrit.instructure.com/16885
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
2013-01-17 14:59:02 -07:00
Zach Pendleton a021c08b19 add option for completed courses on course import. fixes #2184
affects: /courses/:course_id/imports/copy

now provide an "include completed courses?" checkbox that allows
user to also list concluded courses that he/she has permissions
to.

load course dropdown via ajax call, and cache both results for the
select box and the course search autocomplete.

test plan:
  * create two courses;
  * create a user and enroll them as a teacher in both courses (user
    should not be an admin);
  * conclude one of the courses;
  * go to the course copy page of the unconcluded course;
  * verify that the concluded course is not in the dropdown and cannot
    be searched for;
  * check the 'include completed courses?' checkbox;
  * verify that the concluded course now appears in the dropdown and
    can be searched for.

  * create a course in a different term and set the same user as
    teacher;
  * set enrollment start dates for each term;
  * view the copy course page and verify that the terms are ordered
    by start date DESC.

  * create a course in a different account in a term that shares the
    same name as the term in the original account;
  * view the copy course page and verify that the account name is
    appended to the term name in the dropdown menu.

Change-Id: I0af2907e130ae1e0ce6048cac4743234fd0e1fd6
Reviewed-on: https://gerrit.instructure.com/8943
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-03-12 12:06:53 -06:00
Zach Pendleton bd02baee59 paginate enrollments on SectionController#show. fixes #6022
paginate enrollments by loading them through the api. load
new pages by clicking 'View More Enrollments' link.

affects: sections controller
test plan:
  * create course with large number of students (~ 500);
  * visit course section page (/courses/:course_id/sections/:id);
  * verify that page loads first 15 of both current and completed
    enrollments;
  * verify that if no enrollments exist in a category, a 'no enrollments
    found' message is displayed;
  * verify that clicking 'Load More Enrollments' loads another page
    of enrollments;
  * load a course with < 15 enrollments, verify that no 'View More
    Enrollments' link is displayed.

Change-Id: Ied7ccdd8e59a56bef44ffbb07292ecfc0cb97ec5
Reviewed-on: https://gerrit.instructure.com/8365
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-17 16:18:50 -07:00
Ryan Florence a1e31c8c9a AMD Conversion
"Trivial" JavaScript / CoffeeScript changes
--------------------------------------------------

For the most part, all javascript was simply
wrapped in `require` or `define`. The dependencies
were found with a script that matched regexes in
the files, it errs on the side of listing too many
dependencies, so its worth double checking each
file's dependencies (over time, anyway).

i18n API changes
--------------------------------------------------

No longer have to do I18n.scoped calls, just
list i18n as a dependency with the scope and it's
imported already scoped

  require ['i18n!some_scope'], (I18n) ->
    I18n.t 'im_scoped', 'I'm scoped!'

JS bundling now done with r.js, not Jammit
--------------------------------------------------

We don't use jammit to bundle JS anymore. Simply
list dependencies for your JS modules in the file
and RequireJS handles the rest.

To optimize the JavaScript, first make sure you
have node.js 0.4.12+ installed and then run:

  $ rake js:build

The app defaults to the optimized build in
production. You can use non-optimized in
production by putting ?debug_assets=true in the
url just like before.

You can also test the optimized JavaScript in
development with ?optimized_js=true.

Significant changes
--------------------------------------------------

These files have "real" changes to them (unlike
the JavaScript that is simply wrapped in require
and define).  Worth taking a really close look at:

- app/helpers/application_helper.rb
- app/views/layouts/application.html.erb
- config/assets.yml
- config/build.js
- lib/handlebars/handlebars.rb
- lib/i18n_extraction/js_extractor.rb
- lib/tasks/canvas.rake
- lib/tasks/i18n.rake
- lib/tasks/js.rake

Change-Id: I4bc5ecb1231f331aaded0fef2bcc1f3a9fe482a7
Reviewed-on: https://gerrit.instructure.com/6986
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
2012-02-06 16:41:40 -07:00