Nonparametric functional chi-square tests