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