@@ -29,7 +29,41 @@ test.describe('omnibar widget', () => {
2929 } ) ;
3030 } ) ;
3131
32- test ( 'AI chat form submission via button click' , async ( { page } , workerInfo ) => {
32+ test ( 'search form submission with shift+enter submits to new-window' , async ( { page } , workerInfo ) => {
33+ const ntp = NewtabPage . create ( page , workerInfo ) ;
34+ const omnibar = new OmnibarPage ( ntp ) ;
35+
36+ await ntp . reducedMotion ( ) ;
37+ await ntp . openPage ( { additional : { omnibar : true } } ) ;
38+ await omnibar . ready ( ) ;
39+
40+ await omnibar . searchInput ( ) . fill ( 'pizza' ) ;
41+ await omnibar . searchInput ( ) . press ( 'Shift+Enter' ) ;
42+
43+ await omnibar . expectMethodCalledWith ( 'omnibar_submitSearch' , {
44+ term : 'pizza' ,
45+ target : 'new-window' ,
46+ } ) ;
47+ } ) ;
48+
49+ test ( 'search form submission with cmd+enter submits to new-tab' , async ( { page } , workerInfo ) => {
50+ const ntp = NewtabPage . create ( page , workerInfo ) ;
51+ const omnibar = new OmnibarPage ( ntp ) ;
52+
53+ await ntp . reducedMotion ( ) ;
54+ await ntp . openPage ( { additional : { omnibar : true } } ) ;
55+ await omnibar . ready ( ) ;
56+
57+ await omnibar . searchInput ( ) . fill ( 'pizza' ) ;
58+ await omnibar . searchInput ( ) . press ( 'Meta+Enter' ) ;
59+
60+ await omnibar . expectMethodCalledWith ( 'omnibar_submitSearch' , {
61+ term : 'pizza' ,
62+ target : 'new-tab' ,
63+ } ) ;
64+ } ) ;
65+
66+ test ( 'AI chat submit button' , async ( { page } , workerInfo ) => {
3367 const ntp = NewtabPage . create ( page , workerInfo ) ;
3468 const omnibar = new OmnibarPage ( ntp ) ;
3569 await ntp . reducedMotion ( ) ;
@@ -49,6 +83,46 @@ test.describe('omnibar widget', () => {
4983 } ) ;
5084 } ) ;
5185
86+ test ( 'AI chat submit button with shift+click submits to new-window' , async ( { page } , workerInfo ) => {
87+ const ntp = NewtabPage . create ( page , workerInfo ) ;
88+ const omnibar = new OmnibarPage ( ntp ) ;
89+ await ntp . reducedMotion ( ) ;
90+
91+ await ntp . openPage ( { additional : { omnibar : true } } ) ;
92+ await omnibar . ready ( ) ;
93+
94+ await omnibar . aiTab ( ) . click ( ) ;
95+ await omnibar . expectMode ( 'ai' ) ;
96+
97+ await omnibar . chatInput ( ) . fill ( 'pizza' ) ;
98+ await omnibar . chatSubmitButton ( ) . click ( { modifiers : [ 'Shift' ] } ) ;
99+
100+ await omnibar . expectMethodCalledWith ( 'omnibar_submitChat' , {
101+ chat : 'pizza' ,
102+ target : 'new-window' ,
103+ } ) ;
104+ } ) ;
105+
106+ test ( 'AI chat submit button with cmd+click submits to new-tab' , async ( { page } , workerInfo ) => {
107+ const ntp = NewtabPage . create ( page , workerInfo ) ;
108+ const omnibar = new OmnibarPage ( ntp ) ;
109+ await ntp . reducedMotion ( ) ;
110+
111+ await ntp . openPage ( { additional : { omnibar : true } } ) ;
112+ await omnibar . ready ( ) ;
113+
114+ await omnibar . aiTab ( ) . click ( ) ;
115+ await omnibar . expectMode ( 'ai' ) ;
116+
117+ await omnibar . chatInput ( ) . fill ( 'pizza' ) ;
118+ await omnibar . chatSubmitButton ( ) . click ( { modifiers : [ 'Meta' ] } ) ;
119+
120+ await omnibar . expectMethodCalledWith ( 'omnibar_submitChat' , {
121+ chat : 'pizza' ,
122+ target : 'new-tab' ,
123+ } ) ;
124+ } ) ;
125+
52126 test ( 'AI chat keyboard behavior' , async ( { page } , workerInfo ) => {
53127 const ntp = NewtabPage . create ( page , workerInfo ) ;
54128 const omnibar = new OmnibarPage ( ntp ) ;
@@ -80,6 +154,26 @@ test.describe('omnibar widget', () => {
80154 } ) ;
81155 } ) ;
82156
157+ test ( 'AI chat sumission with cmd+enter submits to new-tab' , async ( { page } , workerInfo ) => {
158+ const ntp = NewtabPage . create ( page , workerInfo ) ;
159+ const omnibar = new OmnibarPage ( ntp ) ;
160+ await ntp . reducedMotion ( ) ;
161+
162+ await ntp . openPage ( { additional : { omnibar : true } } ) ;
163+ await omnibar . ready ( ) ;
164+
165+ await omnibar . aiTab ( ) . click ( ) ;
166+ await omnibar . expectMode ( 'ai' ) ;
167+
168+ await omnibar . chatInput ( ) . fill ( 'pizza' ) ;
169+ await omnibar . chatInput ( ) . press ( 'Meta+Enter' ) ;
170+
171+ await omnibar . expectMethodCalledWith ( 'omnibar_submitChat' , {
172+ chat : 'pizza' ,
173+ target : 'new-tab' ,
174+ } ) ;
175+ } ) ;
176+
83177 test ( 'mode switching preserves query state' , async ( { page } , workerInfo ) => {
84178 const ntp = NewtabPage . create ( page , workerInfo ) ;
85179 const omnibar = new OmnibarPage ( ntp ) ;
0 commit comments