File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -238,7 +238,7 @@ export function reactive<T extends object>(obj: T): UnwrapRef<T> {
238238 * Make sure obj can't be a reactive
239239 */
240240export function markRaw < T extends object > ( obj : T ) : T {
241- if ( ! isPlainObject ( obj ) ) {
241+ if ( ! isPlainObject ( obj ) || ! Object . isExtensible ( obj ) ) {
242242 return obj ;
243243 }
244244
Original file line number Diff line number Diff line change @@ -308,6 +308,19 @@ describe('setup', () => {
308308 expect ( warn ) . not . toHaveBeenCalled ( ) ;
309309 } ) ;
310310
311+ it ( 'Should allow to return Object.freeze' , ( ) => {
312+ const vm = new Vue ( {
313+ template : `<div>{{foo.bar}}</div>` ,
314+ setup ( ) {
315+ const foo = Object . freeze ( { bar : 'baz' } ) ;
316+ return {
317+ foo,
318+ } ;
319+ } ,
320+ } ) . $mount ( ) ;
321+ expect ( vm . $el . textContent ) . toBe ( 'baz' ) ;
322+ } ) ;
323+
311324 it ( 'this should be undefined' , ( ) => {
312325 const vm = new Vue ( {
313326 template : '<div></div>' ,
You can’t perform that action at this time.
0 commit comments