mirror of
				https://github.com/shokinn/hosts-go.git
				synced 2025-11-04 04:28:34 +00:00 
			
		
		
		
	feat: add view mode status bar
This commit is contained in:
		
							parent
							
								
									49bf61f8e5
								
							
						
					
					
						commit
						9748c2dde8
					
				
					 5 changed files with 45 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -28,3 +28,20 @@ func TestModelSelection(t *testing.T) {
 | 
			
		|||
	m = nm.(tui.Model)
 | 
			
		||||
	assert.Equal(t, "example.com", m.SelectedEntry().Hostname)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestViewModeStatusBar(t *testing.T) {
 | 
			
		||||
	sample := `127.0.0.1 localhost
 | 
			
		||||
# 192.168.1.10 example.com`
 | 
			
		||||
	lines := strings.Split(sample, "\n")
 | 
			
		||||
	hf, _, err := core.ParseHostsContent(lines)
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	m := tui.NewModel(hf)
 | 
			
		||||
	nm, _ := m.Update(tea.WindowSizeMsg{Width: 80, Height: 20})
 | 
			
		||||
	m = nm.(tui.Model)
 | 
			
		||||
	view := m.View()
 | 
			
		||||
 | 
			
		||||
	assert.Contains(t, view, "VIEW MODE")
 | 
			
		||||
	assert.Contains(t, view, "[✓] localhost")
 | 
			
		||||
	assert.Contains(t, view, "[ ] example.com")
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue