Index: /CKEditor/tests/tt/5305/1.html
===================================================================
--- /CKEditor/tests/tt/5305/1.html	(revision 7168)
+++ /CKEditor/tests/tt/5305/1.html	(revision 7168)
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+	"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+	<title>Ticket: #5305 - BR moved behind next element</title>
+	<meta name="tags" content="editor,unit,all,stable,parser">
+	<script type="text/javascript" src="../../cktester/cell.js"></script>
+	<script>
+( function()
+{
+	var ts, tc, assert = CKEDITOR.test.assert, test = CKEDITOR.test, selector = YAHOO.util.Selector;
+
+	YAHOO.tool.TestRunner.add( ts = new CKEDITOR.test.suites.editorTestSuite(
+		{
+				editorName : 'test_editor_1',
+				name :document.title
+		} ) );
+
+	ts.add( tc = new YAHOO.tool.TestCase(
+		{
+			setUp : function ()
+			{
+				// Force result data un-formatted.
+				ts.editor.dataProcessor.writer._.rules = {};
+				ts.editor.focus();
+			},
+			
+			test_switch_modes: function()
+			{
+				var editor = ts.editor,
+				
+					contentWithSelection = test.getValueAsHtml( 'input' ),
+					output = '<p>line one<br /><br /><img src="http://a.cksource.com/c/1/inc/img/demo-little-red.jpg" /><br />line four</p>';
+				
+				test.setHtmlWithSelection( editor.document.getBody(), contentWithSelection );
+				
+				editor.execCommand( 'source' );
+				
+				this.wait( function ()
+				{
+					editor.execCommand( 'source' );
+				
+					this.wait( function ()
+					{
+						assert.areSame( output, editor.getData() );
+						
+					}, 1000 );
+				}, 1000 );
+			}
+		} ) );
+} )();
+	</script>
+</head>
+<body><textarea id='input'>
+<p>
+line one<br />
+<br />
+<img src="http://a.cksource.com/c/1/inc/img/demo-little-red.jpg" /><br />
+line four
+</p>
+</textarea></body>
+</html>
