@internetarchive/bookreader 5.0.0-55 → 5.0.0-56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -114,6 +114,26 @@ describe('Plugin: URL controller', () => {
114
114
  expect(window.history.replaceState).toHaveBeenCalled();
115
115
  });
116
116
 
117
+ test('switches to hashMode if replaceState errors', () => {
118
+ window.history.replaceState = jest.fn(() => {
119
+ throw new Error('foo');
120
+ });
121
+ BookReader.prototype.currentIndex = jest.fn(() => 1);
122
+ BookReader.prototype.urlReadFragment = jest.fn(() => '');
123
+ BookReader.prototype.paramsFromCurrent = jest.fn(() => ({
124
+ index: 1,
125
+ mode: 2,
126
+ view: 'theater'
127
+ }));
128
+ BookReader.prototype.search = jest.fn();
129
+ br.options.urlMode = 'history';
130
+ br.init();
131
+ br.urlUpdateFragment();
132
+
133
+ expect(window.history.replaceState).toHaveBeenCalled();
134
+ expect(br.options.urlMode).toEqual('hash');
135
+ });
136
+
117
137
  test('does not update URL when search in query string', () => {
118
138
  window.history.replaceState = jest.fn();
119
139
  BookReader.prototype.currentIndex = jest.fn(() => 1);