64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
using System;
|
|
using System.IO;
|
|
using Paca.App.Browser.Features;
|
|
using Paca.Browser.Tabs;
|
|
using Paca.Tests.Infrastructure;
|
|
using Xunit;
|
|
|
|
namespace Paca.Tests.Browser;
|
|
|
|
public class ChromeParityMilestone15Tests
|
|
{
|
|
[Fact]
|
|
public void GetAllOrSearch_빈질의일때_모든_열린탭과_최근닫힌탭_즉시_반환()
|
|
{
|
|
var m = new TabManager(() => new TabItem());
|
|
var t1 = m.NewTab("https://github.com");
|
|
t1.Title = "GitHub";
|
|
var t2 = m.NewTab("https://google.com");
|
|
t2.Title = "Google";
|
|
var t3 = m.NewTab("https://youtube.com");
|
|
t3.Title = "YouTube";
|
|
|
|
// 하나를 닫아 ClosedStack 에 추가
|
|
m.CloseTab(t3);
|
|
|
|
// 빈 질의로 GetAllOrSearch 호출 시 열린 탭 2개 + 닫힌 탭 1개 반환되어야 함 (Chrome Ctrl+Shift+A 기본 동작)
|
|
var results = TabSearchFilter.GetAllOrSearch(m.Tabs, m.ClosedStack, "");
|
|
Assert.Equal(3, results.Count);
|
|
|
|
Assert.False(results[0].IsClosed);
|
|
Assert.Equal("GitHub", results[0].Title);
|
|
|
|
Assert.False(results[1].IsClosed);
|
|
Assert.Equal("Google", results[1].Title);
|
|
|
|
Assert.True(results[2].IsClosed);
|
|
Assert.Equal("YouTube", results[2].Title);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetAllOrSearch_검색어_입력시_부분일치_필터링()
|
|
{
|
|
var m = new TabManager(() => new TabItem());
|
|
var t1 = m.NewTab("https://github.com");
|
|
t1.Title = "GitHub: Where the world builds";
|
|
var t2 = m.NewTab("https://google.com");
|
|
t2.Title = "Google Search";
|
|
|
|
var hits = TabSearchFilter.GetAllOrSearch(m.Tabs, m.ClosedStack, "git");
|
|
Assert.Single(hits);
|
|
Assert.Equal("GitHub: Where the world builds", hits[0].Title);
|
|
}
|
|
|
|
[Fact]
|
|
public void MainWindow_ToggleTabSearch_오픈시_즉시_결과_갱신_검증()
|
|
{
|
|
var csPath = SourceTree.AppPath("MainWindow.xaml.cs");
|
|
Assert.True(File.Exists(csPath), "MainWindow.xaml.cs 파일이 존재해야 합니다.");
|
|
var code = File.ReadAllText(csPath);
|
|
|
|
// ToggleTabSearch 및 TextChanged 에서 GetAllOrSearch 가 사용되어야 함
|
|
Assert.Contains("GetAllOrSearch", code);
|
|
}
|
|
}
|