diff --git a/sample/empty.content.html b/sample/empty.content.html
new file mode 100644
index 000000000..ac9be0156
--- /dev/null
+++ b/sample/empty.content.html
@@ -0,0 +1,3 @@
+
');
+ }));
+
+ describe('linking ui-directive', function () {
+ it('anonymous ui-view should be replaced with the template of the current $state', inject(function ($state, $q) {
+ elem.append($compile('
')(scope));
+
+ $state.transitionTo(aState);
+ $q.flush();
+
+ expect(elem.text()).toBe(aState.template);
+ }));
+
+ it('named ui-view should be replaced with the template of the current $state', inject(function ($state, $q) {
+ elem.append($compile('
')(scope));
+
+ $state.transitionTo(cState);
+ $q.flush();
+
+ expect(elem.text()).toBe(cState.views.cview.template);
+ }));
+
+ it('ui-view should be updated after transition to another state', inject(function ($state, $q) {
+ elem.append($compile('
')(scope));
+
+ $state.transitionTo(aState);
+ $q.flush();
+
+ expect(elem.text()).toBe(aState.template);
+
+ $state.transitionTo(bState);
+ $q.flush();
+
+ expect(elem.text()).toBe(bState.template);
+ }));
+
+ it('should handle NOT nested ui-views', inject(function ($state, $q) {
+ elem.append($compile('
')(scope));
+
+ $state.transitionTo(dState);
+ $q.flush();
+
+ expect(elem[0].querySelector('.dview1').innerText).toBe(dState.views.dview1.template);
+ expect(elem[0].querySelector('.dview2').innerText).toBe(dState.views.dview2.template);
+ }));
+
+ it('should handle nested ui-views (testing two levels deep)', inject(function ($state, $q) {
+ elem.append($compile('
')(scope));
+
+ $state.transitionTo(fState);
+ $q.flush();
+
+ expect(elem[0].querySelector('.view').querySelector('.eview').innerText).toBe(fState.views.eview.template);
+ }));
+ });
+
+ describe('handling initial view', function () {
+ it('initial view should be compiled if the view is empty', inject(function ($state, $q) {
+ var content = 'inner content';
+
+ elem.append($compile('
')(scope));
+ scope.$apply('content = "' + content + '"');
+
+ $state.transitionTo(gState);
+ $q.flush();
+
+ expect(elem[0].querySelector('.test').innerText).toBe(content);
+ }));
+
+ it('initial view should be put back after removal of the view', inject(function ($state, $q) {
+ var content = 'inner content';
+
+ elem.append($compile('
')(scope));
+ scope.$apply('content = "' + content + '"');
+
+ $state.transitionTo(hState);
+ $q.flush();
+
+ expect(elem.text()).toBe(hState.views.inner.template);
+
+ // going to the parent state which makes the inner view empty
+ $state.transitionTo(gState);
+ $q.flush();
+
+ expect(elem[0].querySelector('.test').innerText).toBe(content);
+ }));
+ });
+
+});