Improved test for replace attribute