|
1 | 1 | const { test } = QUnit; |
2 | 2 | import $ from 'jquery'; |
| 3 | +import { extend } from 'core/utils/extend'; |
| 4 | +import consoleUtils from '__internal/core/utils/m_console'; |
3 | 5 | import 'ui/file_manager'; |
4 | 6 | import fx from 'common/core/animation/fx'; |
5 | 7 | import windowUtils from 'core/utils/window'; |
@@ -32,17 +34,49 @@ const prepareFileManager = (context, isPure, options) => { |
32 | 34 | context.clock.tick(400); |
33 | 35 | }; |
34 | 36 |
|
| 37 | +const moduleConfig_T1297188 = { |
| 38 | + beforeEach: function() { |
| 39 | + const markup = '<div id="fileManagerPopup"></div>'; |
| 40 | + $('#qunit-fixture').html(markup); |
35 | 41 |
|
36 | | -QUnit.testStart(function() { |
37 | | - const markup = |
38 | | - '<div id="fileManager"></div>'; |
| 42 | + this.clock = sinon.useFakeTimers(); |
| 43 | + fx.off = true; |
| 44 | + this.clock.tick(400); |
| 45 | + }, |
| 46 | + afterEach: function() { |
| 47 | + this.clock.tick(5000); |
| 48 | + this.clock.restore(); |
| 49 | + fx.off = false; |
| 50 | + } |
| 51 | +}; |
39 | 52 |
|
40 | | - $('#qunit-fixture').html(markup); |
41 | | -}); |
| 53 | +const createFileManagerInsidePopup = (context, useThumbnailViewMode, extOptions) => { |
| 54 | + const viewMode = useThumbnailViewMode ? 'thumbnails' : 'details'; |
| 55 | + extOptions = extOptions || {}; |
| 56 | + const options = extend({ |
| 57 | + fileSystemProvider: createTestFileSystem(), |
| 58 | + itemView: { |
| 59 | + mode: viewMode |
| 60 | + } |
| 61 | + }, extOptions); |
| 62 | + const fileManagerPopup = $('#fileManagerPopup').dxPopup({ |
| 63 | + visible: true, |
| 64 | + contentTemplate: function(contentElement) { |
| 65 | + $('<div id="fileManager"></div>') |
| 66 | + .appendTo(contentElement) |
| 67 | + .dxFileManager(options); |
| 68 | + } |
| 69 | + }).dxPopup('instance'); |
| 70 | + context.clock.tick(400); |
| 71 | + return fileManagerPopup; |
| 72 | +}; |
42 | 73 |
|
43 | 74 | const moduleConfig = { |
44 | 75 |
|
45 | 76 | beforeEach: function() { |
| 77 | + const markup = '<div id="fileManager"></div>'; |
| 78 | + $('#qunit-fixture').html(markup); |
| 79 | + |
46 | 80 | this.clock = sinon.useFakeTimers(); |
47 | 81 | fx.off = true; |
48 | 82 | }, |
@@ -207,3 +241,25 @@ QUnit.module('Markup rendering', moduleConfig, () => { |
207 | 241 | }); |
208 | 242 |
|
209 | 243 | }); |
| 244 | + |
| 245 | +QUnit.module('fileManager inside popup not causing any warnings in console (T1297188)', moduleConfig_T1297188, () => { |
| 246 | + test('no console warnings displayed (T1297188)', function(assert) { |
| 247 | + const loggerSpy = sinon.spy(consoleUtils.logger, 'warn'); |
| 248 | + |
| 249 | + try { |
| 250 | + createFileManagerInsidePopup(this, false, { width: '100%', height: '100%' }); |
| 251 | + |
| 252 | + this.clock.tick(400); |
| 253 | + |
| 254 | + const w1025Warning = loggerSpy.args.find(([warning, ...rest]) => |
| 255 | + typeof warning === 'string' && warning.includes('W1025') |
| 256 | + ); |
| 257 | + |
| 258 | + assert.ok(!w1025Warning, 'W1025 scrolling.mode warning should not appear in console'); |
| 259 | + |
| 260 | + } finally { |
| 261 | + loggerSpy.restore(); |
| 262 | + } |
| 263 | + }); |
| 264 | +}); |
| 265 | + |
0 commit comments