// SPDX-License-Identifier: LGPL-2.1-only
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>

use super::*;

#[ derive( Clone, Debug, PartialEq, Eq ) ]
enum Msg { Pick( usize ) }

#[ test ]
fn defaults()
{
	let t: TabBar<Msg> = TabBar::new( vec![ "a", "b", "c" ] );
	assert_eq!( t.labels.len(), 3 );
	assert_eq!( t.selected, 0 );
	assert!( t.on_select.is_none() );
}

#[ test ]
fn selected_builder()
{
	let t: TabBar<Msg> = TabBar::new( vec![ "a", "b" ] ).selected( 1 );
	assert_eq!( t.selected, 1 );
}

#[ test ]
fn on_select_invokes_callback()
{
	let t: TabBar<Msg> = TabBar::new( vec![ "a", "b" ] ).on_select( Msg::Pick );
	let cb = t.on_select.as_ref().expect( "callback set" );
	assert_eq!( cb( 1 ), Msg::Pick( 1 ) );
}

#[ test ]
fn strip_bg_none_disables_background()
{
	let t: TabBar<Msg> = TabBar::new( vec![ "a" ] ).strip_bg_none();
	assert!( t.strip_bg.is_none() );
}
