File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 11{{if .Statuses}}
22 {{if and (eq (len .Statuses) 1) .Status.TargetURL}}
3- <a class="flex-text-inline tw-no-underline {{.AdditionalClasses}}" data-global-init="commit-statuses " href="{{.Status.TargetURL}}">
3+ <a class="flex-text-inline tw-no-underline {{.AdditionalClasses}}" data-global-init="initCommitStatuses " href="{{.Status.TargetURL}}">
44 {{template "repo/commit_status" .Status}}
55 </a>
66 {{else}}
7- <span class="flex-text-inline {{.AdditionalClasses}}" data-global-init="commit-statuses " tabindex="0">
7+ <span class="flex-text-inline {{.AdditionalClasses}}" data-global-init="initCommitStatuses " tabindex="0">
88 {{template "repo/commit_status" .Status}}
99 </span>
1010 {{end}}
Original file line number Diff line number Diff line change @@ -240,7 +240,7 @@ func TestRepoCommitsStatusMultiple(t *testing.T) {
240240 resp = session .MakeRequest (t , req , http .StatusOK )
241241
242242 doc = NewHTMLParser (t , resp .Body )
243- // Check that the data-global-init="commit-statuses " (for trigger) and commit-status (svg) are present
244- sel := doc .doc .Find (" #commits-table .message [data-global-init=\" commit-statuses \ " ] .commit-status" )
243+ // Check that the data-global-init="initCommitStatuses " (for trigger) and commit-status (svg) are present
244+ sel := doc .doc .Find (` #commits-table .message [data-global-init="initCommitStatuses "] .commit-status` )
245245 assert .Equal (t , 1 , sel .Length ())
246246}
Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ export function initRepoEllipsisButton() {
1212}
1313
1414export function initCommitStatuses ( ) {
15- registerGlobalInitFunc ( 'commit-statuses ' , async ( el : HTMLElement ) => {
16- const top = document . querySelector ( '.repository.file.list' ) || document . querySelector ( '.repository.diff' ) ;
17-
15+ registerGlobalInitFunc ( 'initCommitStatuses ' , async ( el : HTMLElement ) => {
16+ const nextEl = el . nextElementSibling ;
17+ if ( ! nextEl . matches ( '.tippy-target' ) ) throw new Error ( 'Expected next element to be a tippy target' ) ;
1818 createTippy ( el , {
1919 content : el . nextElementSibling ,
20- placement : top ? 'top-start' : 'bottom-start' ,
20+ placement : 'bottom-start' ,
2121 interactive : true ,
2222 role : 'dialog' ,
2323 theme : 'box-with-header' ,
You can’t perform that action at this time.
0 commit comments