This repository has been archived by the owner on Feb 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ElementPanel): display scope properties for children of Document…
…Fragments Sort of related to angular/angular.js#6637 --- Currently, jqLite#inheritedData() will not find data if it needs to cross through document fragment barriers, such as the Shadow DOM barrier. This patch allows batarang to figure this out. In addition, it provides some tests for the angularjs properties sidebar of the element panel, which were missing previously. Closes #104
- Loading branch information
Showing
3 changed files
with
64 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
describe('elements panel', function() { | ||
|
||
afterEach(function() { | ||
$0 = null; | ||
}); | ||
|
||
|
||
describe('angular properties sidebar', function() { | ||
describe('getPanelContents()', function() { | ||
it('should return properties for scope of selected element', inject(function($rootScope) { | ||
var element = angular.element('<div><p>Hello, world</p></div>'); | ||
element.data('$scope', $rootScope); | ||
$rootScope.text = "Hello, world!"; | ||
$0 = element[0]; | ||
expect (getPanelContents().text).toBe("Hello, world!"); | ||
$0 = element.children().eq(0)[0]; | ||
expect (getPanelContents().text).toBe("Hello, world!"); | ||
})); | ||
|
||
|
||
it('should cross shadow DOM barrier via DocumentFragment#host', inject(function($rootScope) { | ||
var parent = document.createElement('div'), | ||
fragment = document.createDocumentFragment(), | ||
child = document.createElement('p'); | ||
fragment.host = parent; | ||
fragment.appendChild(child); | ||
parent.appendChild(fragment); | ||
|
||
parent = angular.element(parent); | ||
parent.data('$scope', $rootScope); | ||
$rootScope.text = "Fragmented fun for everyone"; | ||
|
||
$0 = child; | ||
expect(getPanelContents().text).toBe("Fragmented fun for everyone"); | ||
})); | ||
}); | ||
}); | ||
}); |