const assert = require('assert') const fs = require('fs') const source = fs.readFileSync( require('path').resolve(__dirname, '../src/components/editor/index.vue'), 'utf8' ) assert.match( source, /onCreated\s*:\s*\(editor\)\s*=>\s*\{\s*editor\.focus\(\)/, 'editor must initialize a Slate selection after creation so toolbar buttons are enabled' ) assert.match( source, /data\(\)\s*\{\s*return\s*\{\}\s*\}/, 'wangEditor instances must stay outside Vue 2 reactive data to avoid revoked Slate proxies' ) assert.match( source, /const editor\s*=\s*createEditor[\s\S]*this\._editor\s*=\s*editor/, 'editor must be stored as a non-reactive private instance field' ) assert.match( source, /height:\s*600px\s*!important/, 'editor container must be at least 300px high for modal and hoverbar positioning' )