Commit Graph

567 Commits

Author SHA1 Message Date
Chris Adams
59a254bea6 Tests: add open failure tests, overhaul test framework
* Add tests for open failures
* Refactor tests to avoid tests depending on implied status from
  previous tests:
  1. The viewer is now created and destroyed for each
     test to avoid pollution and simplify error handling: nothing
     starts until you request it.
  2. Some tests like Basic: Homepage depended on the Zoom & Pan tests;
     now this is handled explicitly as part of the test setup
  3. All basic tests are now properly async tests (since they needed
     the viewer to load, they really were in the past except that
     they were relying on the viewer state left behind from previous
     tests)
* All tests now run inside the qunit-fixture to prevent masking
  failures. Util.resetDom() has been refactored to use the
  qunit-fixture and the teardown logic only used in the navigator
  tests has been moved into the navigator test teardown method
* Fixed undeclared mainViewerElement variable in optional path in
  the navigator tests
* JSHint cleanup
2013-07-01 18:26:44 -04:00
Chris Adams
0ed4703bd3 Viewport messages: add a class to the dialog for easy styling 2013-07-01 18:26:44 -04:00
Chris Adams
7048cda69e Tests: getString with placeholder expansion 2013-07-01 16:55:39 -04:00
Chris Adams
1ab6094420 Viewer: make viewport messages private, repeatable
* Marked _showMessage/_hideMessage as private
* Fix DOM manipulation bug: call standard removeNode() method rather
  than proprietary WebKit .remove()
* Change messageDiv to be the outer wrapper to simplify removing the
  entire message container
2013-07-01 13:43:48 -04:00
Chris Adams
b912896158 Viewer.showMessage() hides any previous message 2013-07-01 12:58:22 -04:00
Chris Adams
d447bd5612 Remove detritus left behind from error handler testing 2013-07-01 12:55:58 -04:00
Chris Adams
9de45ba281 Refactor OpenSeadragon.makeCenteredNode
* Use CSS display tables for vertical centering (tested back to IE8)
* Use the DOM instead of string concatenation
* Remove redundant styles ($.makeNeutralElement sets the same values
  for margin, padding & border)
* Return the outer wrapper element to ease DOM addition & removal
2013-06-28 15:52:48 -04:00
Chris Adams
1f345e4cc5 Viewer: refactor message code into showMessage/hideMessage methods
This avoids the need to deal with classes, and explicitly makes it
reusable for other needs
2013-06-28 15:46:31 -04:00
Chris Adams
630bccad3d Basic demo: set HTML5 doctype
This keeps IE8 out of quirks mode, which breaks things like 
getWindowSize…
2013-06-28 15:44:38 -04:00
Chris Adams
7f42dfc032 code style 2013-06-28 15:01:56 -04:00
Chris Adams
fb7c91acd2 code style 2013-06-28 14:54:44 -04:00
Chris Adams
7dcf662fdd Viewer: add a basic error message display system
This might be something we want to make configurable for users who want
to completely control how errors are displayed.

This also adds the first use of OpenSeadragon.makeCenteredNode currently
so we might want to clean up that code as well.
2013-06-28 14:32:57 -04:00
Chris Adams
2bf6b13bfe User-visible warning when tile sources fail to load
This is currently using window.alert in lieu of something more sophisticated but it works for indicating 404s or invalid file
contents
2013-06-28 14:11:20 -04:00
Chris Adams
494bf7fe41 strings: add logging for untranslated source messages
This should probably be changed to be closer to the goal of being
like gettext but we can at least tell developers when we clobber the
string
2013-06-28 14:11:19 -04:00
Chris Adams
464428cef7 makeAjaxRequest: don't set request to null
Setting onreadystatechange can avoid the possibility of it somehow being
called twice but there's no point in nulling the request right before we
let the GC collect it.
2013-06-28 14:00:02 -04:00
Chris Adams
db38b71dd9 makeAjaxRequest: throw error for missing callback 2013-06-27 16:03:43 -04:00
Chris Adams
1c6a57c710 makeAjaxRequest: log all errors, test callback
* All AJAX errors will log to the console
* The onError callback will only be called if defined
2013-06-27 16:03:41 -04:00
Chris Adams
5eccdfee98 Better match project style 2013-06-27 15:58:09 -04:00
Chris Adams
496b7d757b Simplify OpenSeadragon.makeAjaxRequest
* Since async is always true – and browsers are starting to deprecate
  synchronous XHR – we were able to prune considerable amount of code
* Add an error callback to match the existing success callback
2013-06-27 15:58:09 -04:00
iangilman
bb1dd78979 Merge pull request #148 from acdha/test-globals-cleanup
Tests: avoid leaking into global scope
2013-06-27 09:33:36 -07:00
Chris Adams
c850121e9b Tests: avoid leaking into global scope
This means that this will pass without error:

http://127.0.0.1:8000/test/test.html?noglobals=true
2013-06-26 16:54:37 -04:00
Ian Gilman
dcbb338083 Changelog for #136 2013-06-26 09:38:07 -07:00
iangilman
8fe0ce26b8 Merge pull request #136 from acdha/jshint-cleanup
JSHint tidying
2013-06-26 09:37:08 -07:00
Ian Gilman
e731c850b5 Changelog for #144 2013-06-26 09:24:55 -07:00
iangilman
f4139cef38 Merge pull request #144 from acdha/143-xhr-error-handling
Safe cleanup in makeAjaxRequest error handler
2013-06-26 09:23:04 -07:00
Ian Gilman
ae3c68a646 Added changelog for #142 2013-06-26 09:15:48 -07:00
Ian Gilman
3f1072b321 Fixed typos in comments 2013-06-26 09:15:37 -07:00
iangilman
1df4448be7 Merge pull request #142 from blind-coder/master
Fix for calculating overlay width / height
2013-06-26 09:13:31 -07:00
Chris Adams
c648c1df8a drawer: don't leak drawLevel into global namespace
This code is still under-tested and documented but no longer relies on
`drawLevel` being leaked into the global namespace where `updateLevel`
to find it.

See #145
2013-06-25 14:26:09 -04:00
Chris Adams
f2cba16a8b Safe cleanup in makeAjaxRequest error handler
Previously `request.onreadystatechange` was assigned an empty function
on success but null on failures, which breaks in IE (see
http://jsbin.com/ezozax/6/).

This patch simply mimics the success behaviour in the cleanup function

Closes #143
2013-06-25 14:13:45 -04:00
Benjamin 'blindCoder' Schieder
0150622e78 fix error when recalculating overlay width and height 2013-06-25 18:01:38 +02:00
Chris Adams
c2107fcb22 Declare _processDZIError directly on OpenSeadragon 2013-06-21 16:37:31 -04:00
Ian Gilman
9cbda1bd8f Updated changelog for #138 2013-06-21 09:30:45 -07:00
iangilman
67e588b513 Merge pull request #141 from felizuno/now2
Implementing the new OpenSeadragon.now()
2013-06-21 09:28:37 -07:00
Kevin Ewing
8896c2278d Fixed mistake 2013-06-20 13:31:04 -07:00
Kevin Ewing
2ba3acda38 Removed extra parens 2013-06-20 13:23:16 -07:00
Kevin Ewing
248852c15f Implementing OpenSeadragon.now()
Replacing both `+new Date()` and `new Date().getTime()` with `$.now()`
2013-06-20 13:15:04 -07:00
Chris Adams
9ef6e085c8 viewer.js: update onfullscreenchange handler comment 2013-06-20 15:17:48 -04:00
Chris Adams
de29a34890 viewer.js: remove dead code 2013-06-20 15:12:55 -04:00
Chris Adams
72f0f05d2f JSHint: disable unused variable check
This is nice but until jshint/jshint#1146 is fixed there's no way to
selectively disable W098 for unused function arguments which we wish to
include for documentary purposes.

With this change there are only three remaining warnings, all of which
are actionable.
2013-06-20 15:12:54 -04:00
Chris Adams
adc4147304 Expose semi-private processDZIError for use by DziTileSource
This previously wasn't in scope outside of the main OpenSeadragon
closure. Now it's exposed with an underscore prefix to encourage people
not to think of it as a public interface.
2013-06-20 15:12:54 -04:00
Chris Adams
51bb8ca46e openseadragon.js: fix imageFormatSupported refs 2013-06-20 15:12:54 -04:00
Chris Adams
169244ed1a navigator.js: omit unused borderWidth from func args 2013-06-20 15:12:54 -04:00
Chris Adams
0d09183159 referencestrip.js: move variable declaration to the top of loadPanels 2013-06-20 15:12:54 -04:00
Chris Adams
eafc822aa8 openseadragon.js: remove unused builtin aliases 2013-06-20 15:12:54 -04:00
Chris Adams
8c433ba81c Declare assumed globals 2013-06-20 15:12:54 -04:00
Chris Adams
e2bea810e3 Replace gnarly ternary expression with if statement 2013-06-20 15:12:53 -04:00
Chris Adams
64d94ac2bd referencestrip.js: declare undeclared variable 2013-06-20 15:12:53 -04:00
Chris Adams
f8c77f65d7 viewer.js: fix typos in variable declarations 2013-06-20 15:12:53 -04:00
Chris Adams
d644acd50b Fix lack of braces on if statements
JavaScript's most popular rack in the grass for maintenance coders…
2013-06-20 15:12:53 -04:00