diff --git a/src/dev-utils/model.js b/src/dev-utils/model.js
index 3c403207e..045ad7fd4 100644
--- a/src/dev-utils/model.js
+++ b/src/dev-utils/model.js
@@ -100,7 +100,8 @@ export function setData( document, data, options = {} ) {
// Parse data string to model.
const parsedResult = setData._parse( data, document.schema, {
lastRangeBackward: options.lastRangeBackward,
- selectionAttributes: options.selectionAttributes
+ selectionAttributes: options.selectionAttributes,
+ context: [ modelRoot.name ]
} );
// Retrieve DocumentFragment and Selection from parsed model.
diff --git a/tests/controller/deletecontent.js b/tests/controller/deletecontent.js
index 546c44902..c9bcc2373 100644
--- a/tests/controller/deletecontent.js
+++ b/tests/controller/deletecontent.js
@@ -311,14 +311,14 @@ describe( 'DataController', () => {
it( 'deletes two inline elements', () => {
setData(
doc,
- 'x[]z',
+ 'x[]z',
{ rootName: 'paragraphRoot' }
);
deleteContent( doc.selection, doc.batch() );
expect( getData( doc, { rootName: 'paragraphRoot' } ) )
- .to.equal( 'x[]z' );
+ .to.equal( 'x[]z' );
} );
it( 'creates a paragraph when text is not allowed (paragraph selected)', () => {
diff --git a/tests/dev-utils/model.js b/tests/dev-utils/model.js
index c81b00af2..7e0179750 100644
--- a/tests/dev-utils/model.js
+++ b/tests/dev-utils/model.js
@@ -157,6 +157,18 @@ describe( 'model test utils', () => {
expect( document.selection.getAttribute( 'foo' ) ).to.equal( 'bar' );
} );
+ // #815.
+ it( 'should work in a special root', () => {
+ const document = new Document();
+
+ document.schema.registerItem( 'textOnly' );
+ document.schema.allow( { name: '$text', inside: 'textOnly' } );
+ document.createRoot( 'textOnly', 'textOnly' );
+
+ setData( document, 'a[b]c', { rootName: 'textOnly' } );
+ expect( getData( document, { rootName: 'textOnly' } ) ).to.equal( 'a[b]c' );
+ } );
+
function test( data, expected ) {
expected = expected || data;