mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
764677431f
Following changes done for the framework: - Framework for creating React based dynamic form view out of a pre-defined UI schema. Previously, it was based on Backform/Backbone. - The new framework and components will use MaterialUI as the base. Previously, Bootstrap/Backform/jQuery components were used. - The new code uses JSS instead of CSS since material UI and most modern React libraries also use JSS. In the future, this will allow us to change the theme in real-time without refresh. - 90% code covered by 80-85 new jasmine test cases. - Server group node UI Schema migration to new, with schema test cases. - Server node UI Schema migration to new, with schema test cases. - Database node UI Schema migration to new, with schema test cases. - Few other UI changes. Fixes #6130
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
/////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
import jasmineEnzyme from 'jasmine-enzyme';
|
|
import React from 'react';
|
|
import '../helper/enzyme.helper';
|
|
import {default as OrigCodeMirror} from 'bundled_codemirror';
|
|
|
|
import CodeMirror from 'sources/components/CodeMirror';
|
|
import { mount } from 'enzyme';
|
|
|
|
describe('CodeMirror', ()=>{
|
|
let cmInstance, options={
|
|
lineNumbers: true,
|
|
mode: 'text/x-pgsql',
|
|
}, cmObj = jasmine.createSpyObj('cmObj', {'setValue': ()=>{}, 'refresh': ()=>{}});
|
|
beforeEach(()=>{
|
|
jasmineEnzyme();
|
|
spyOn(OrigCodeMirror, 'fromTextArea').and.returnValue(cmObj);
|
|
cmInstance = mount(
|
|
<CodeMirror
|
|
value={'Init text'}
|
|
options={options}
|
|
className="testClass"
|
|
/>);
|
|
});
|
|
|
|
it('init', ()=>{
|
|
/* textarea ref passed to fromTextArea */
|
|
expect(OrigCodeMirror.fromTextArea).toHaveBeenCalledWith(cmInstance.getDOMNode(), options);
|
|
expect(cmObj.setValue).toHaveBeenCalledWith('Init text');
|
|
expect(cmObj.refresh).toHaveBeenCalled();
|
|
});
|
|
|
|
it('change value', ()=>{
|
|
cmInstance.setProps({value: 'the new text'});
|
|
expect(cmObj.setValue).toHaveBeenCalledWith('the new text');
|
|
expect(cmObj.refresh).toHaveBeenCalled();
|
|
});
|
|
});
|